Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:7281 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 33741 invoked by uid 1010); 22 Jan 2004 19:33:08 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 33712 invoked from network); 22 Jan 2004 19:33:08 -0000 Received: from unknown (HELO shiva.mind.de) (212.42.230.204) by pb1.pair.com with SMTP; 22 Jan 2004 19:33:08 -0000 Received: from [192.168.1.100] (p508EB09B.dip.t-dialin.net [80.142.176.155]) by shiva.mind.de (Postfix) with ESMTP id DA67997B64; Thu, 22 Jan 2004 20:33:01 +0100 (CET) Date: Thu, 22 Jan 2004 20:34:37 +0100 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <125-1581635562.20040122203437@marcus-boerger.de> To: Stephane Drouard Cc: internals@lists.php.net In-Reply-To: <20040122144819.42410.qmail@pb1.pair.com> References: <20040122144819.42410.qmail@pb1.pair.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] base class From: helly@php.net (Marcus Boerger) 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