Hello Stephane,
Thursday, January 22, 2004, 3:48:19 PM, you wrote:
> PHP implements an "stdClass". I expected that:
> * this was the base class for all classes, even if they do not explicitly "extends stdClass",
nope, there is absolutely no reason for that
> * this class implemented all the "standard" methods (__construct(), __destruct(), ...).
all __* are magic functions they must not exist and are not meant to be
called directly (which seems to be your problem). It is just easy: never
call a __* method directly with the exception neing __clone() which works
slightly different.
> In the PHP5 presentation, it is mentionned the interest of unified
> constructors. Currently it is not possible to call parent::__construct()
> if the class does not derived from another one, or none of its parent
> implements a constructor.
Well you design a class tree/framework and should know what you have done.
If not use reflection.
> Another problem: when you change a class implementation and decide to
> now implement a constructor, you have to review all its derived classes.
> Which finally limits the benefit of unified constructors.
A change is a change.
> I think all classes should be derived from a common base class
> (stdClass or a new dedicated one), even if it's not explicitly written.
> This base class should also implement all the standard methods:
[...]
That would slow down execution ***very*** much and makes absolutely no
sense at all. If you want a base class for your classes do it. Fell free.
Do implement whatever classtree/framework you whish to have. But don't
misuse internal classes.
--
Best regards,
Marcus mailto:helly@php.net