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

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

Reply via email to