Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:68445 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48991 invoked from network); 8 Aug 2013 18:06:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Aug 2013 18:06:06 -0000 Authentication-Results: pb1.pair.com smtp.mail=rstoll@tutteli.ch; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rstoll@tutteli.ch; sender-id=pass Received-SPF: pass (pb1.pair.com: domain tutteli.ch designates 80.74.154.78 as permitted sender) X-PHP-List-Original-Sender: rstoll@tutteli.ch X-Host-Fingerprint: 80.74.154.78 ns73.kreativmedia.ch Linux 2.6 Received: from [80.74.154.78] ([80.74.154.78:54636] helo=hyperion.kreativmedia.ch) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 78/4B-06453-B0ED3025 for ; Thu, 08 Aug 2013 14:06:05 -0400 Received: (qmail 20831 invoked from network); 8 Aug 2013 20:06:00 +0200 Received: from 99-206.5-85.cust.bluewin.ch (HELO RoLaptop) (85.5.206.99) by ns73.kreativmedia.ch with (AES128-SHA encrypted) SMTP; 8 Aug 2013 20:06:00 +0200 To: "'Leigh'" , "'Matthieu Napoli'" Cc: References: <52037411.7070406@seld.be> In-Reply-To: Date: Thu, 8 Aug 2013 20:05:58 +0200 Message-ID: <007f01ce9461$ef7f29b0$ce7d7d10$@tutteli.ch> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQH8AJsLJ6ss5Qr6v/nRB+14W1tvmwFIpp0jAiR2ydYCLWpHLgH1YwCEAb4zNoCY5khcwA== Content-Language: de-ch Subject: AW: [PHP-DEV] RFC: constructor argument promotion From: rstoll@tutteli.ch ("Robert Stoll") I agree, that looks nice. It is still readable IMO and removes the boilerplate code in the constructor (and setters and where needed) This proposal seems much better to me because the class members $foo and $bar are still in the same place as usual and the compiler does not = generate magic code as before. -----Urspr=FCngliche Nachricht----- Von: Leigh [mailto:leight@gmail.com]=20 Gesendet: Donnerstag, 8. August 2013 17:17 An: Matthieu Napoli Cc: internals@lists.php.net Betreff: Re: [PHP-DEV] RFC: constructor argument promotion On 8 August 2013 14:12, Matthieu Napoli wrote: > class MyClass { > public $foo; > protected $bar; > > public function __construct($this->foo, $this->bar, $baz) { > // $this->foo and $this->bar are now set > This actually feels _way_ more intuitive to me, it feels like you are passing the parameter directly into that property. With that style, why even limit it to the ctor? function mySetter(array $this->items) {}