Re: [RFC]Discuss] Syntax for Arrow Functions

From: Date: Mon, 19 Jun 2017 20:22:53 +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-99563@lists.php.net to get a copy of this message
So what's on the table is a syntax-improved but feature-crippled variant of closures, not an all-round replacement? If I have to factor back and forth between new and old syntax every time a closure changes from one to multiple or back to one statement, then, frankly, what's the point? I think I would just keep using the old syntax, then - for consistency, and to save myself the frustration of factoring back and forth. The old syntax is a burden, but a new feature with limited applicability, honestly, I think would be even more of a burden. In my opinion, if this is worth doing, it's worth doing it right. On Mon, Jun 19, 2017 at 10:12 PM, Larry Garfield <larry@garfieldtech.com> wrote: > > > On 06/19/2017 03:45 PM, Rasmus Schultz wrote: > >> Or maybe it'll look okay if you format the code? >> >> $things->forEach({$v => { >> foo($v); >> bar($v); >> }}); >> >> Still looks kinda crazy with the closing "}})" though... >> > > Multi-line lambdas should use the existing syntax without changes. The > only thing being discussed here is single-statement lambdas that you would > want to inline and think of as an expression rather than a function call. > If you need something more complex than that just use the existing syntax. > > --Larry Garfield > > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >

« previous php.internals (#99563) next »