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 <la...@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 > >