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





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

Reply via email to