This RFC proposes a way to have multi-line short closures — closures that don't need explicit use
statements, but can still have multiple lines and a return statement.
I like the idea of auto-capture!
Makes them more useful!
usable
Best of both worlds (auto-capture + ability to build return value using intermediate variables).
Callbacks are the bread-and-butter of any modern PHP developer, so being able to trim down the cruft to make code more consise and readable is a no-brain win.
When using utility functions that expect callable/Closure as parameters you are currently forced to bring over all required variables with the use statement. Depending on context that can be a lot of variables and any time the code changes you need to keep track of that list of variables.
Having used short closures for a while now they feel really good.
I think the proposition is not "must have" option but it's ok
the biggest advantage for me is that you then need to use the use
keyword when you need data from outside.
Just use "fn" everywhere my fingers hurt from typing "uction" all the time.
Multi lines short closures with arrow function? What we're missing!
It makes my code much clearly
since we are moving in the c# direction, why not take a really good thing they do
That's a very good idea. More convenient than using use
I don't see a reason for not implementing this. It would make writing closures much more easy and natural.
A new syntax for declaring the “set” operation visibility of an object property
Chain method on newly created objects without parentheses
Interface Default Methods improves backwards compatibility when changing interfaces, but also add a way to have multi-inheritance in PHP.