Re: Re: [RFC][Discuss] Arrow Functions

From: Date: Wed, 01 Feb 2017 15:45:50 +0000
Subject: Re: Re: [RFC][Discuss] Arrow Functions
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-98108@lists.php.net to get a copy of this message
On Tue, Jan 31, 2017 at 12:41 PM, Andrea Faulds <ajf@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

« previous php.internals (#98108) next »