> On Feb 3, 2017, at 9:06 PM, Stephen Reay <php-li...@koalephant.com> wrote: > > >> On 4 Feb 2017, at 07:25, Aaron Piotrowski <aa...@trowski.com> wrote: >> >> $callback = |int|float $x| => $x ** 2; > > Forget the parser, you're giving my eyes diabetes trying to read that.
I absolutely agree that it's terrible… the point is that types (even potential future union types) can be used with short closures, but it certainly doesn't mean they should be. I don't think confusion with a non-existent and non-recommended way of coding should be a reason against a particular syntax. > As has been said before, PHP is relatively verbose compared to other > languages. That makes it slightly more characters to type, but it also makes > it absolutely clear what is happening. Using `function` IMO makes it more likely to confuse a short closure with a regular closure. Reusing the `function` keyword with different semantics may result in some confusion. > As Niklas said, all ambiguity/clarity issues are solved by using "function", > at the cost of 6 characters. > > Suggesting that a search for arrow functions will be easier with <insert > random character here> and then using grep (which could also easily match > arrow functions using "function") as your example search seems odd to me. I never suggested this, Björn Larsson did. Any of the possibilities mentioned in this thread could easily be searched. Regards, Aaron Piotrowski -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php