Hi, Why not make all objects (maybe implicitly) extend a single root object, containing just skeleton ctor/dtor and implemented in the engine ?
I don't know if it is actually possible in PHP, but that works for several other languages (java, objC - in that case, the root object is explicit-, C# AFAR) This would also bypass the error-level debate (no error would be thrown) -- Regards, Benjamin Dubois Le 16 mai 2011 à 23:25, Etienne Kneuss a écrit : > Hi, > > On May 16 16:52:08, Andrew Curioso wrote: >> Well, that wasn't where I was expecting that thread to go, but to wrap it up >> what do you think... >> Is it too late to put this on the 5.4 roadmap for consideration? >> >> I'm assuming just the implicit ctor and dtor. Not all magic methods (not >> now, at least). >> >> With your OK, Stas, I'd like to write up an RFC and put it on the Wiki. >> >> - Andrew > > The main problem with internal classes and ctors is that constructor > code can be placed at object init instead of in the actual ctor method. > It is actually safer to place it at object init, because then that code > is always executed and thus the internal object is not in a half > initialized state if the user overwrites the constructor and doesn't > call the parent. > > I'd rather have ctors/dtors explicitely defined in SPL. If they are > documented to exist, they should be explicitely defined. We can define > such NOOP methods globally, so that it is easy for internal classes to add > them. > > As far as implicitly ignore of the constructor, I believe we have enough > magic regarding ctors/dtors in the engine as it is. > > Best, > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php >