Re: RFC: Support for multi-line arrow functions

From: Date: Mon, 05 Oct 2020 13:37:16 +0000
Subject: Re: RFC: Support for multi-line arrow functions
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-112006@lists.php.net to get a copy of this message
On 05.10.20 12:24, Andreas Leathley wrote:
On 05.10.20 12:08, Lynn wrote:
How should php deal with the scenario where you want to use everything and have one variable by reference?
function () use (*, &$butNotThisOne) {};
The easiest would be to only allow "use (*)" with no references or additional syntax. "use (*)" would only copy all local variables into the closure, no references. Personally I have never used references with "use", I think it is much more niche compared to the regular copying, and there is still the explicit (current) syntax to do references.
FTR, short arrow function implicitly only support "by value" bindings, I just checked the docs. I do use by ref with closures btw. - Markus

« previous php.internals (#112006) next »