PHP implements an "stdClass". I expected that: * this was the base class for all classes, even if they do not explicitly "extends stdClass", * this class implemented all the "standard" methods (__construct(), __destruct(), ...).
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. 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. 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: __construct() Empty. __destruct() Empty. __clone() Does the bit for bit copy of the object. Note: I also added a post concerning a new cloning implementation proposal. In that case, __clone() would be empty. __toString() To be compatible with the current implementation, this method should return "Object id #n". However I would prefer it returns the class name instead, which gives a more useful piece of information than it's ID. __get() Display the "Notice: Undefined property ..." and returns NULL. __set() Create a new member (public). Note: I would appreciate that a notice is also displayed, because I don't consider this is a normal way to create members. __call() Generates a "Fatal error: Call to undefined method ...". Regards, Stephane -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php