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).

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to