On Tue, Jan 31, 2017 at 12:41 PM, Andrea Faulds <a...@ajf.me> wrote:
>
> That's the idea. I'd prefer it if auto-capture was not restricted to
> single-expression functions (“arrow functions”). Though arrow functions
> make most sense with auto-capture, it doesn't need to be stricted to them.


This goes against a very basic characteristic of PHP. The fact that you
have to be explicit about globals and outer scope variables leaves you with
a clean sandbox with no side effects inside your function. Changing that,
especially after the fact for existing closures, is a complete non-starter
and would subtly break a ton of code.

The reason it is feasible to do this for single-expression closures in this
short form syntax is that you don't typically need a local scope at all for
these short closures and the syntax doesn't convey the idea that you would
have a local scope.

-Rasmus

Reply via email to