Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:52420 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35633 invoked from network); 17 May 2011 08:40:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 May 2011 08:40:35 -0000 Authentication-Results: pb1.pair.com header.from=petercowburn@gmail.com; sender-id=pass; domainkeys=bad Authentication-Results: pb1.pair.com smtp.mail=petercowburn@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.42 as permitted sender) DomainKey-Status: bad X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: petercowburn@gmail.com X-Host-Fingerprint: 209.85.160.42 mail-pw0-f42.google.com Received: from [209.85.160.42] ([209.85.160.42:34675] helo=mail-pw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 35/E2-05118-18432DD4 for ; Tue, 17 May 2011 04:40:33 -0400 Received: by pwj3 with SMTP id 3so205885pwj.29 for ; Tue, 17 May 2011 01:40:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; bh=W8iH2jlKfqQX55mzkZV5qVPafPTHjSI9cqnStwPdn6A=; b=gfDw045Oj3K6O49cbjFutjn3S4w4G9LERTCMm6dgn9gme3UDWcQGUdPO02O+3RZbVM FBgjZeiyGnXP+euDDEaflQ5xbNrEON+2vIsGL7yAWC0xBRomB8+lgAK8QRul3AcnAvre imasBRYEAtYl+plaM0/j+GfWXwPtpyhmThMcw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; b=HBVAa2oEuA0IXMkjbqafpXXZ0sBbicwGjCHDCQd7QtF7ZtaRDNuBwZRNOtSlGD7sF4 XFkzoHuAyUO81ghMqoka/7tlLeqwHg/eUGOoQHr28AZ/rxmlVqdYrX+7vpGG8ySBUOU5 ckEqARiFH2C1CV8EUWkAOH0cx3guQBUzOzlqY= Received: by 10.68.62.228 with SMTP id b4mr171333pbs.164.1305621630052; Tue, 17 May 2011 01:40:30 -0700 (PDT) MIME-Version: 1.0 Received: by 10.68.47.228 with HTTP; Tue, 17 May 2011 01:39:50 -0700 (PDT) In-Reply-To: <20110516212511.GA13139@crousti> References: <1305570720.1344.535.camel@guybrush> <4DD17ECD.4070505@sugarcrm.com> <20110516212511.GA13139@crousti> Date: Tue, 17 May 2011 09:39:50 +0100 Message-ID: To: Etienne Kneuss Cc: internals@lists.php.net Content-Type: text/plain; charset=ISO-8859-1 Subject: Re: [PHP-DEV] Inconsistencies with constructors in SPL From: petercowburn@gmail.com (Peter Cowburn) Hi folks, On 16 May 2011 22:25, Etienne Kneuss wrote: > 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. This. In the short term, regardless of what happens with the code, the documentation should reflect what is available in the language. If a constructor is documented but not available to call then the documentation needs to be clear about that. Any instances of this currently in the docs should be a bug, it's an idea to report them onto the bugs system. As for what changes in the code, I think it would be nice for all (SPL) classes to have a (global, noop) constructor even if nothing of interest happens within it so that userland developers can happily, blindly, call the parent constructor in their classes. As an aside, do the changes made against #54384 have any impact here? > > 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 > >