The fn() syntax was a non-conflicting alternative, which got most support for being not too weird.
[1] https://docs.hhvm.com/hack/functions/anonymous-functions
Bike shedding can certainly be done infinitely and sometimes one has to make a choice and move on.
(I have been release manager of PHP in earlier times and helped to steer through the namespace seperator debate and did the decision to not do short array syntax, yet, but wasn't involved in the short function syntax debate)
I'd love to have a shorter object syntax, too. For the time being, I'll make do with
$city = (object)['name' => 'Berlin', 'population' => 3748000];
which is a little verbose but gets the job done. $city = new City {name: 'Berlin, population: 374800};
Edit: found it (and it uses = instead of :) https://wiki.php.net/rfc/object-initializerhttps://www.reddit.com/r/PHP/comments/50xcmi/what_happened_t...
Perhaps php should also drop all type information so it can be more like the cluster fuck that is “modern” JavaScript too? Maybe change “const” so the constants it declares aren’t... constant?
There would be ambiguity without it: https://wiki.php.net/rfc/arrow_functions_v2#syntax
$a=[$x ~> $x*2, $x ~> $x*$x];
$a[1](5); // 25
Looks cool to me.Also PHP tries to be "googlable". Typing "fn PHP" into Google should bring relevant hits, for people never seen such a construct.
If not insisting on the "google" part, there always is http://symbolhound.com/?q=php+%7E%3E
Since we are talking about new features of PHP: Does anybody else wish there were named parameters?
I think PHP is pretty complete. It is my favorite language and I don't really wish for anything added to it. Except for two things:
1: The named parameters of Python:
2: The short object Syntax of Javascript: