Re: [RFC]Discuss] Syntax for Arrow Functions

From: Date: Wed, 07 Jun 2017 19:45:27 +0000
Subject: Re: [RFC]Discuss] Syntax for Arrow Functions
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  Groups: php.internals 
Request: Send a blank email to internals+get-99441@lists.php.net to get a copy of this message
> the fn($a, $b) => $a + $b ** $c syntax suddenly becomes an > acceptable compromise. I have to second that. I might even propose to shorten it from "fn" to just "f" - the resulting syntax then resembles a mathematical predicate :-) On Wed, Jun 7, 2017 at 5:20 PM, Stephen Reay <php-lists@koalephant.com> wrote: > > > On 7 Jun 2017, at 20:37, Björn Larsson <bjorn.x.larsson@telia.com> > wrote: > > > > Well, one reason to use fn or even lambda was to signal that this is > > different then a regular function. > > > > When it comes to number of keystrokes I guess that some inspiration > > has been taken from other languages supporting arrow functions, like > > Javascript & HACK. > > > > I also recall from earlier discussions, that with less keystrokes it's > easier > > to read when an arrow function is embedded / chained into another > > expression / statement / function call. > > > > > I think its pretty clear my pref is/was #2, but when compared to the crazy > alternatives people have been suggesting, which just seem to be “hold down > shift and blindly poke at the non-letter keys for a while”, the `fn($a, $b) > => $a + $b ** $c` syntax suddenly becomes an acceptable compromise. > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.internals (#99441) next »