> -----Ursprüngliche Nachricht----- > Von: Andrea Faulds [mailto:a...@ajf.me] > Gesendet: Montag, 3. November 2014 16:40 > An: Robert Stoll > Cc: PHP Internals > Betreff: Re: [PHP-DEV] Types on the right or on the left > > > > On 3 Nov 2014, at 15:07, Robert Stoll <p...@tutteli.ch> wrote: > > > > It adds the type hint on the right hand side of the function (of the > > identifier). In contrast to parameters where the type hint is placed on the > > left hand side of the identifier. > > Mixing both, having some types on the left and others on the right, > > seems like another inconsistency in the language design to me. > > These inconsistencies exist for two reasons: > > - Opposition to doing it the other way > - Hack already doing it this way > > I don’t think `function void foo();` will happen, since that’s been > previously rejected as it breaks gripping for “function foo”. > Similarly, I don’t think `public $foo: Foo;` will happen, given Hack does it > as `public Foo $foo;`. > > PHP doesn’t need more inconsistency, sure, but we must be practical here. It > is bad if PHP and Hack have the same feature > with different syntax, it will cause developer confusion and further segment > the communities. It is bad if we don’t get > return type hinting because the “consistent” syntax would upset some people. > > -- > Andrea Faulds > http://ajf.me/ >
I agree with you to a certain degree, PHP and Hack should not diverge but (kind of <b>but</b>)... IMO Hack made a wrong language design decision and I do not see why PHP should make the same mistake. And I am sure, Hack would catch up quickly if PHP would decide to put all types on the right (as in the return type hint RFC - just as an example). -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php