Re: Enums, flags and ::
| From: | Steph Fox | Date: | Tue, 25 Oct 2005 20:52:12 +0000 |
| Subject: | Re: Enums, flags and :: | ||
| References: | 1 2 3 4 5 6 | Groups: | php.gtk.dev |
| Request: | Send a blank email to php-gtk-dev+get-1955@lists.php.net to get a copy of this message | ||
Hey Scott,
The readability point of view's where we started. Unfortunately your
'readability point of view' clashes diametrically with mine :)
I just did some rough head-counts:
ATK has 8 enum classes
PANGO has 12 enum classes and 1 flag class
GDK has 39 enum classes and 10 flag classes
GTK has 69 enum classes, 19 flag classes, 5 non-enum constants and 15
fundamental types
GLADE doesn't register anything other than its class type
So far so good. Then I looked at Tom's early Scintilla work and blanched.
SCN (or whatever its prefix ends up being) apparently has over a thousand
separate registered class constants. This may or may not be the way
ext/scintilla ends up - but it kind of gives weight to Andrei's argument.
Point taken. It's not what we have now, it's what we _might_ have in the
future that's the issue here. In the face of which, I'm forced to back down
& mourn the passing of GTK_*.
Anyone else have any strong views over the way GTK::INTERNAL_ENUM should be
written in our code and docs, while we're there?
- Steph
----- Original Message -----
From: "Scott Mattocks" <scott@crisscott.com>
To: "Andrei Zmievski" <andrei@gravitonic.com>
Cc: "Steph Fox" <steph@zend.com>; "PHP-GTK dev"
<php-gtk-dev@lists.php.net>;
"Madeleine D." <mmdrake@bctonline.com>
Sent: Tuesday, October 25, 2005 9:31 PM
Subject: Re: [PHP-GTK-DEV] Enums, flags and ::
> Andrei Zmievski wrote:
> > On Oct 25, 2005, at 1:04 PM, Steph Fox wrote:
> >
> >> 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.
> >
> > What about GDK_*? PANGO_*? ATK_*? GLADE_*? SOMEOTHEREXTENSION_*? How
> > will this look when all the extensions register their constants
globally?
>
> Personally, I like having everything separated out by extension. I think
> Gtk::SOME_CONSTANT is cleaner than GTK_SOME_CONSTANT. (Please note my
> not so subtle vote for Gtk as opposed to GTK) I don't think that
> sticking with Gtk+ style is a valid argument. By that argument we should
> have the same function calls to. I don't think anyone wants to have
> gtk_tree_view_get_selection() instead of $treeView->get_selection().
>
> I don't think the scope of a constant matters much to the end user. No
> matter what scope a constant is in, it should behave the same. I think
> this needs to be addressed from a PHP-GTK programmer's readability point
> of view and I just think that Gtk:: is easier to read and follow than
GTK_.
>
> Scott