I think that it makes it easier to parse for the eyes than `\($x, $y) => $x * $y` when it's used as a function argument: `array_reduce(\($acc, $curr => $acc+$curr), $arr, 0)`
@TheodoreBrown it already has an obvious meaning, [], I think it's well established by now that we can't just use what is used elsewhere, because => already has a meaning, fn coming first makes it easy to understand what follows better than \, which also has meaning for php ...
> Ilija Tovilo analyzed the top 1,000 PHP repositories on GitHub to find usages of fn. The gist provides more information, but the rough findings are that all known existing usages of fn are in tests except one case where it is a namespace segment. (The namespace use happens to be in my own library, and I'm happy to rename it.)
reminds me of an (horrible written) application where the most important object was in a variable called $v. workmate killed it with a foreach(... as ... => $v). We searched at least two hours for the error
@JoeWatkins Yeah, I'm not saying that the BC break is a huge issue. :) It's just that either way users will have to learn what the prefix means, and I'd like to save 3 more characters for the common single-parameter case.
@NikiC note that for the nested arrow function syntax, this will be mainly single parameters where we can just not use parens as well, don't consider that an argument really that it's "noisy"
it's actually even fewer characters then
with a clearer delimitation where the short closure ends
@NikiC That grammar is fundamentally ambiguous, T_YIELD T_ARROW_START expr ')' T_DOUBLE_ARROW expr this obviously conflicts within expr at least… 1 token lookahead is not enough to distinguish it from parameter_list