Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:71910 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 87657 invoked from network); 31 Jan 2014 23:57:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Jan 2014 23:57:47 -0000 Authentication-Results: pb1.pair.com header.from=johannes@schlueters.de; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=johannes@schlueters.de; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain schlueters.de from 217.114.215.10 cause and error) X-PHP-List-Original-Sender: johannes@schlueters.de X-Host-Fingerprint: 217.114.215.10 mail.experimentalworks.net Received: from [217.114.215.10] ([217.114.215.10:54626] helo=mail.experimentalworks.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 82/E6-54292-A783CE25 for ; Fri, 31 Jan 2014 18:57:47 -0500 Received: from [192.168.2.31] (ppp-88-217-64-231.dynamic.mnet-online.de [88.217.64.231]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: johannes@schlueters.de) by mail.experimentalworks.net (Postfix) with ESMTPSA id D82183FEE8; Sat, 1 Feb 2014 00:58:20 +0100 (CET) To: Dan Ackroyd Cc: Pascal Chevrel , "internals@lists.php.net" In-Reply-To: References: <98.E0.35265.E17FBE25@pb1.pair.com> <1391203805.2941.173.camel@guybrush> <1391210014.2941.224.camel@guybrush> Content-Type: text/plain; charset="UTF-8" Date: Sat, 01 Feb 2014 00:57:41 +0100 Message-ID: <1391212661.2941.230.camel@guybrush> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [VOTE] Automatic Property Initialization From: johannes@schlueters.de (Johannes =?ISO-8859-1?Q?Schl=FCter?=) On Fri, 2014-01-31 at 23:48 +0000, Dan Ackroyd wrote: > Hi Johannes, > > Johannes wrote: > > from a quick look at it there seems to be a design flaw > > around inheritance with code like this: > > That example is equivalent to calling the parent constuctor like this: > > class Base { > public $p; > > function __construct($this->p = 42); > } > > Class E extends Base { > function __construct($value) { > $this->p = $value; > parent::__construct(); > } > } > > So yes - you need will still need to pass parameters to a parent > constructor that requires them, but that is the same as the current > situation. Right. Still one should be aware of this and might be worth adding to RFC. "Correct" usage would of course be be passing parameters through explicitly. > Johannes wrote: > > also > > class C { public function m($foo->prop){}} > > becomes valid syntax > > Nope, it's constructors only. From the patch, the following errors can > be triggered: > > "Automatic property initialization can only be used inside a class" > "Automatic property initialization can only be used in a constructor" > "Automatic property initialization can not be used in an abstract method" > > If you try to use the syntax outside of a constructor function. As said - just had a quick look and didn't think much. if those are triggered during compilation (which would be obvious as only the compiler is changed ...) then its fine. Thanks for reviewing! johannes