> On Feb 3, 2017, at 2:34 PM, ilija.tov...@me.com wrote:
> 
> I like the suggested syntax. The only drawback I see is that it inhibits the 
> future addition of union types for closures:
> 
>     |int | float $x| => $x
> 
> Adding parentheses of course resolves the issue but looks a bit awkward:
> 
>     |(int | float) $x| => $x
> 
> Apart from that I have nothing to complain about. I'd be happy either way.
> 


While it may be ugly, I do not believe that this has any ambiguity.

    $callback = |int|float $x| => $x ** 2;

When the second | is not followed by =>, the parser should be able to discern 
that a union type is being used.

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

Reply via email to