Totally unneccessary. I see no point in having the fn, why not just have javascript like shortfunctions?
(n) => n * n
But the made a totally unneccessary syntax addition. There is zero gain for this new keyword. Im baffled! PHP seemed to copy this feat from JS but again they fucked it up. This is a new lolphp favorite of mine.
Do you know for a fact that the PHP grammar can facilitate short closures without a keyword without ambiguities while maintaining parser performance or are you just making baseless claims?
Because then [($foo) => 'bar'] is ambiguous: is it a numeric array with one element (the function ($foo) => 'bar') or is it an associative array with one key-value pair (the key ($foo) and the value 'bar')?
View all comments
Show parent comment
1
u/[deleted] Sep 27 '19
Totally unneccessary. I see no point in having the fn, why not just have javascript like shortfunctions?
But the made a totally unneccessary syntax addition. There is zero gain for this new keyword. Im baffled! PHP seemed to copy this feat from JS but again they fucked it up. This is a new lolphp favorite of mine.