Re: [RFC][Discuss] Arrow Functions
| From: | Björn Larsson | Date: | Tue, 30 May 2017 18:08:29 +0000 |
| Subject: | Re: [RFC][Discuss] Arrow Functions | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-99272@lists.php.net to get a copy of this message | ||
Den 2017-05-30 kl. 17:09, skrev Levi Morrison:
the programmer / reader of code. Also I think it stands out more in code reviews and if one by mistake looses [], would it then generate a parsing error or be treated as valid syntax. Maybe also a bit simpler to implement then "[]() => expr" in the PHP engine, but I'm guessing on this one though...Well, my preference would be for alternative 3. Not in favour of 2 & 4. Nr 1 not so sure about and for nr 5, maybe tweak it to:Can you explain why you want a longer arrow? To improve readability and also make it less ambiguous for- [](params) ==> expr // binds no values - [=](params) ==> expr // binds by value - [&](params) ==> expr // binds by reference
Leaving out [] could also be a default:Or maybe that is why? Yup, one reason!- (params) ==> expr // binds no values
then fn(params) that we have something different here. r//BjörnI presume then that the options discussed earlier "|params| => expr" and "lamda(params) => expr" are of the table.The|params| => exprsyntax is off the table, yes. I don't remember anyone taking thelambda(params) => exprsuggestion seriously; my apologies if I'm simply remembering this incorrectly. I recall some liking it (like me ;-) since it's a clearer signal