On 01.02.2014 20:53, Sara Golemon wrote:
On Sat, Feb 1, 2014 at 11:43 AM, Gordon Oheim <
[email protected]> wrote:
On 01.02.2014 20:25, Sara Golemon wrote:
FYI, I'm voting "No" as I don't think
https://wiki.php.net/rfc/constructor-promotion was considered
adequately. They both seek to accomplish the same goal, but one
introduces conflicting syntax while the other does not.
If we're to go with the conflicting syntax, I'd like to see a
reasonable argument why.
How is it conflicting?
Because it's different from already existing syntax (Code exists in
the wild using HHVM's version of the syntax -
https://wiki.php.net/rfc/constructor-promotion ). I'm not sure which
part you're confused about.
-Sara
I wasn't sure whether you meant that or some conflicts with core PHP syntax. Thanks for clarifying.
As much as I am looking forward to see HHVM mature, I don't think just because something is in HHVM already, it should have more weight when it comes to RFCs. It would effectively give FB control over what gets into PHP this way, simply because you are not community bound in what you add to HHVM. But I guess that's a topic for a wholly different debate.
A more immediate reason might be that the Ctor Promotion (CP) does more than just Automatic Property Initialization (API). It also does property declaration. That is entirely missing from the API RFC and makes the latter much less of a change than CP. It has virtually no impact on future features.
Personally, I don't like CP's declaration aspect, because it forces me to divide property declaration. Ctor injectable properties need to be declared in the ctor signature, while any others need to be declared in the class body (correct me if I am wrong please). I find that less readable and somewhat confusing.
I can see another issue in CP RFC #9: "Properties promoted in this fashion would not have their own DocBlock". How would that work then for frameworks using annotations, like Doctrine or Flow3? Again, this is not an issue when just using Automatic Property Initialization.
Don't get me wrong though. I think CP is an interesting proposal. But the consequences of also declaring properties makes the whole thing much more critical and it requires more thought to consider it for an addition.
-Gordon