Re: Enums, flags and ::

From: Date: Tue, 25 Oct 2005 20:04:53 +0000
Subject: Re: Enums, flags and ::
References: 1 2 3  Groups: php.gtk.dev 
Request: Send a blank email to php-gtk-dev+get-1950@lists.php.net to get a copy of this message
Hi Andrei, See what you mean - I hadn't gone as far as actually looking at the code, just assumed you were accessing the GEnumValue directly without reference to the GEnumClass somehow. (Don't ask, it's Tuesday, my brain doesn't kick in til Thursday night.) What's the deal about global scope? OK there could be namespace collisions - but on the other hand those are GTK+ constants, easily recognisable and AFAIK used everywhere that uses GTK+. It'd have to be a very 'newbie' error to name a local constant GTK_*, given that scenario. If it's trivial to go back to global scope and doesn't have any god-awful side-effects, I for one would very much like to see it happen. Thanks, - Steph ----- Original Message ----- From: "Andrei Zmievski" <andrei@gravitonic.com> To: "Steph Fox" <steph@zend.com> Cc: "PHP-GTK dev" <php-gtk-dev@lists.php.net>; "Madeleine D." <mmdrake@bctonline.com> Sent: Tuesday, October 25, 2005 8:38 PM Subject: Re: [PHP-GTK-DEV] Enums, flags and :: > Actually, looking up GTK_WIN_POS_MOUSE is faster than > Gtk::WIN_POS_MOUSE, but not by that much. My main goal was to separate > things cleanly, so that the global namespace doesn't contain all the > constants. If you think that this is not something we should worry > about, I guess we can put the constants back into the global scope. > > -Andrei > > On Oct 25, 2005, at 11:30 AM, Steph Fox wrote: > > > Hi Madeleine, > > > > It's down to PHP 5/Zend Engine 2's object support. We didn't have > > this in > > PHP 4, so the bindings were made via GtkEnumType and we had the same > > syntax > > as in GTK+. > > > > Basically all it means is that something like, say, GTK_WIN_POS_MOUSE, > > is > > now registered as a constant named WIN_POS_MOUSE within a > > zend_class_entry > > struct named GTK. > > > > I have to say it makes absolute sense to do it this way from an > > internals > > perspective - much cleaner, and probably faster when it comes to > > lookups - > > it's just a bit of a thrower on the user side. > > > > - Steph > > > > > > ----- Original Message ----- > > From: "Madeleine D." <mmdrake@bctonline.com> > > To: "Steph Fox" <steph@zend.com>; "Andrei" > > <andrei@gravitonic.com> > > Cc: "PHP-GTK dev" <php-gtk-dev@lists.php.net> > > Sent: Tuesday, October 25, 2005 7:12 PM > > Subject: Re: [PHP-GTK-DEV] Enums, flags and :: > > > > > >> Steph - > >> > >> I hit the same thing on my upgrade attempt. > >> > >> Christian's right, in that I see so much that needs to be changed > >> already, > >> the Enums/Flags would be just one more thing to do. Since I've got > >> about > >> 40k of code, that's no small thing, but it's not fatal either. > >> > >> My question is: why do they need to change? What is being gained > >> here? > >> > >> Madeleine D. > >> > >> > >> > >> At 04:50 PM 10/25/05 +0100, Steph Fox wrote: > >>> Before it's too late (assuming it isn't already): Is there any way > >>> we can > >>> return enums/flags to the standard GTK format, as they were in > >>> PHP-GTK 1? > >>> > >>> If you remember that far back, I spent more than a day trying to > >>> work out > >>> what I was doing wrong when every enum in sight failed in an old > >>> script I > >>> upgraded to PHP-GTK 2. I don't think I'm going to be the only > > scriptkiddie > >>> baffled by that change. > >>> > >>> It's also the one area Christian and I can't come to an agreement > >>> over in > >>> our coding standards discussions, because what _should_ be a > >>> constant is > >>> being treated as some kind of a pseudo-method, which makes either > > approach > >>> inconsistent by definition. > >>> > >>> I know it'd be a BC breakage for PHP-GTK 2 to change this now, but > >>> then > >>> again we haven't released v. 2 yet. At present it's a BC breakage > >>> for > >>> PHP-GTK 1, which is probably more serious. > >>> > >>> So the question is, do enums and flags _have_ to be registered as > >>> class > >>> entry constants for ZE 2 to deal with them? Or is it just a matter > >>> of > >>> convenience? > >>> > >>> - and the next question is, assuming it's possible to register them > >>> as > >>> global constants, should we? > >>> > >>> - Steph > >>> > >>> -- > >>> PHP-GTK Development Mailing List (http://gtk.php.net/) > >>> To unsubscribe, visit: > >>> http://www.php.net/unsub.php > >>> > >>> >

« previous php.gtk.dev (#1950) next »