Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:80791 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 16026 invoked from network); 19 Jan 2015 10:26:50 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Jan 2015 10:26:50 -0000 Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.199 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.199 imap11-2.ox.privateemail.com Received: from [192.64.116.199] ([192.64.116.199:49809] helo=imap11-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id C2/A9-64889-6EBDCB45 for ; Mon, 19 Jan 2015 05:26:48 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 11F2C8800DB; Mon, 19 Jan 2015 05:26:44 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at imap11.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap11.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id OVaXRwTe7ygh; Mon, 19 Jan 2015 05:26:43 -0500 (EST) Received: from oa-res-26-240.wireless.abdn.ac.uk (oa-res-26-240.wireless.abdn.ac.uk [137.50.26.240]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 524FD8800DA; Mon, 19 Jan 2015 05:26:43 -0500 (EST) Mime-Version: 1.0 (Mac OS X Mail 8.1 \(1993\)) Content-Type: text/plain; charset=utf-8 X-Priority: 3 In-Reply-To: Date: Mon, 19 Jan 2015 10:26:40 +0000 Cc: internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: <3C77D1E5-ACF1-442D-BC84-59E49EFD6A5E@ajf.me> References: <0DD30A0D-E7CA-4150-83E0-8FD46635279C@ajf.me> <8761c6280g.fsf@margaine.com> <54B91D16.70901@gmail.com> <78.22.47555.7C24AB45@pb1.pair.com> <1421519637.40188.1.camel@proposaltech.com> <54BABA93.9070809@gmail.com> To: Tony Marston X-Mailer: Apple Mail (2.1993) Subject: Re: [PHP-DEV] [RFC] Remove PHP 4 Constructors From: ajf@ajf.me (Andrea Faulds) > On 19 Jan 2015, at 10:05, Tony Marston = wrote: >=20 > "Marcio Almada" wrote in message = news:CAOsHV+uhO3OVS-BEQMDjomz4SDWOYjN7ZNMCqMT8BYyNuGQVXw@mail.gmail.com...= >>=20 >>> Perhaps there should be a new rule which says that invoking a = constructor with anything other than "new" or "parent::__contruct()" >>> should be illegal, in which case this situation would generate an = error. >>=20 >> Now this would break a lot of code that $obj->__construct(); or >> $this->__construct(); And I've seen a lot of it. >=20 > Surely, according to the principles of OO, a class constructor should = ONLY be called when the class is constructed/instantiated into an object = via the "new" verb? Google for "class constructor" and you will see all = those links which say the same thing. Inheritance is also an OO principle, and typically a derived class=E2=80=99= s constructor will call the parent=E2=80=99s. -- Andrea Faulds http://ajf.me/