2013/9/27 Gordon Oheim <g...@php.net> > > Independent but related to > > - > https://wiki.php.net/rfc/**constructor-promotion<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://wiki.php.net/rfc/automatic_property_initialization> > - > https://github.com/php/php-**src/pull/474<https://github.com/php/php-src/pull/474> > > I am proposing this for inclusion in 5.6. > There is no BC breaks afaik. > > The RFC suggests to allow for $this->foo as Constructor arguments to make > the boilerplate code for property assignments in constructors superfluous. > This is the core feature subject to discussion. >
I simply don't like it to have a concrete method without body. Either abstract without body, or concrete _with_ body. In this case it would mean to have an empty body public function __construct ($this->x) {} but I think that wouldn't be too bad :) > > I've spoken to about two dozen developers outside internals prior to > suggesting this RFC and the general response was positive and the core > feature unanimously deemed useful. Moreover, in the previous discussion > about constructor promotion there was some messages suggesting that the now > proposed syntactic approach is more preferred than using visibility > keywords. > > The RFC also suggests some related syntactic sugar like Methodless > Constructors, an alternate and shorter syntax, as well as making this > available in the entire class scope. These are things I am not sure of so I > am hoping for comments on these. Should this RFC get into the voting phase, > we should by then have either promoted or eliminated these options through > discussion. > > Thanks and Regards, Gordon > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- github.com/KingCrunch