Re: Constructor semantics

From: Date: Thu, 11 Nov 2004 06:07:16 +0000
Subject: Re: Constructor semantics
References: 1  Groups: php.gtk.dev 
Request: Send a blank email to php-gtk-dev+get-772@lists.php.net to get a copy of this message
Hi Andrei
Hi gang, Never been part of such thing, and proud to be now!
So, in our case, should we just stick with how PHP-GTK1 constructors worked or should we try to allow pseudo-keyword invokation? $align = new GtkAlignment(array('xalign' => 1.0, 'yalign' => 0.0, 'xscale' => 0.5));
I see only one problem: What if a constructor really needs only an array of, lets say titles as first parameter? How to distinguish between normal an option-based invocation? This could be solved by assuming that with one parameter, it always has to be option-based invoc, but that would break BC. If that would be no problem, then I think it is a nice-to-have.
The second question is what should we do if constructor encounters an error. In PHP-GTK 1 we invalidated $this variable (setting it to NULL), but in PHP-GTK 2 I am tempted to raise an exception. That would be the oo way. Java does the same AFAIK. +1 from me.
Just now there is the problem that old program would run even if one assignment failed, here you'd need to catch the exceptions or the prog dies. PS: Andrei, just something for the "the-doc-people-would-like-to-have-it" list: It would help very very very much if there would be a glade function which connects all signals defined in the glade to functions of an OBJECT. In php-gtk1 there are only functions which connect the signals assigned to functions in the glade file to objectless functions - that's not very oo. Regards/MfG, Christian Weiske -- XMMS is playing now:

Attachment: [application/pgp-signature] OpenPGP digital signature signature.asc
« previous php.gtk.dev (#772) next »