Re: Enums/flags as objects?

From: Date: Wed, 11 Aug 2004 12:29:54 +0000
Subject: Re: Enums/flags as objects?
References: 1  Groups: php.gtk.dev 
Request: Send a blank email to php-gtk-dev+get-714@lists.php.net to get a copy of this message
Andrei Zmievski wrote:
I have just discovered that it is possible to register object constants. This raises interesting possibilities. In PHP-GTK 1, the various enums/flags are simply integers, so it is hard sometimes to figure out what 0 or 2 means when trying to debug the applications. With the object approach, each enum could be an object wrapper, that knows how to compare itself, output its string representation, etc. The downside is that objects take more memory, obviously. Do you think wrapping enums/flags as objects has advantages? PyGtk 2.3.x seems to do it this way.
I agree with Christian. It seems like a lot of work for a little gain. We are talking about debugging code so if the only benefit is what gets output, that is not really too critical. Are there other benefits that would come from this? What about use in regular (not debugging) code though? To create a popup window would you first have to instantiate a GTK_WINDOW_POPUP object? Again it seems like a lot of work to pass the number 2 to a constructor. Scott

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