> $closure = function () use ($this->getFooBar() as $foo) { > $foo->stuff(); > }
But this can already be written as : $closure = function () { $foo = $this->getFooBar(); $foo->stuff(); } Here, $foo also only exists inside the closure. > Also, remember that the closure is in fact another function, a function > that performs its own actions independent of the parent. Actions may be independent, but as a closure is declared inside its parent, both codes have very strong relationship. For the reader, overriding this relationship with new closure-local var names can weaken its understanding of the code don't you think? > function () use($long as $l, &$long as $r) { > } is currently written as function () use(&$long) { $l = $long; $r =& $long; } While it's a bit longer, the only difference is that $long doesn't exists inside the closure with use.. as ... But is it a strong enough benefit to introduce a new syntax? Considering as I said above that the vars "used" inside closures should keep their parents scope name for readability, I personally fail to think so currently. Did I miss a other benefit? regards, Nicolas