Re: RFC: Automatic Property Initialization
| From: | Matthieu Napoli | Date: | Fri, 27 Sep 2013 08:04:57 +0000 |
| Subject: | Re: RFC: Automatic Property Initialization | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-69380@lists.php.net to get a copy of this message | ||
Le 27/09/2013 09:17, Gordon Oheim a écrit :
Independent but related to - https://wiki.php.net/rfc/constructor-promotion I wrote an RFC about porting Dart-like Automatic Property Initialization to PHP. Nikic was so generous to provide an initial PoC for it (since I don't do C): - https://wiki.php.net/rfc/automatic_property_initialization - https://github.com/php/php-src/pull/474I really like the proposal. I just wonder about how it could mix/conflict with the named parameters proposal? Given what you said about Reflection ($this->foo is treated like $foo), then I guess it's not a problem then. However maybe the RFC should reflect that you can't use: public function __construct($this->foo, $foo) { … } Also, at first glance I didn't find the "methodless constructor" very useful (since it's only saving "{}"), but actually the possibility to use this feature in setters too looks very good, it would avoid a lot of boilerplate code.