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/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'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