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

I 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.

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to