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

From: Date: Wed, 01 Feb 2017 16:05:49 +0000
Subject: Re: Re: [RFC][Discuss] Arrow Functions
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-98109@lists.php.net to get a copy of this message
On Wed, Feb 01, 2017 at 07:45:50AM -0800, Rasmus Lerdorf wrote: > 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. Does this mean, in the context of this RFC, that short-form lambdas won't have their own scope though? I think it's not clear from RFC. Example: // would this create $ret in the outer scope assuming $ret was not // defined array_map(fn($elt) => $ret[] = $elt, [1]); var_dump($ret); // NULL or array(1) ? Current implementation (available on 3v4l.org) does create a local scope, but it should probably be explicitly stated in the RFC (and docs, should the RFC get accepted).

« previous php.internals (#98109) next »