Den 2022-06-29 kl. 19:30, skrev Larry Garfield:
On Thu, Jun 9, 2022, at 11:34 AM, Larry Garfield wrote:
Last year, Nuno Maduro and I put together an RFC for combining the
multi-line capabilities of long-closures with the auto-capture
compactness of short-closures.  That RFC didn't fully go to completion
due to concerns over the performance impact, which Nuno and I didn't
have bandwidth to resolve.

Arnaud Le Blanc has now picked up the flag with an improved
implementation that includes benchmarks showing an effectively net-zero
performance impact, aka, good news as it avoids over-capturing.

The RFC has therefore been overhauled accordingly and is now ready for
consideration.

https://wiki.php.net/rfc/auto-capture-closure

The conversation has died down, so we'll be opening the vote for this tomorrow.

Two changes of note since the discussion started:

* The option to mix explicit capture and implicit capture has been removed as 
too confusing/unpredictable.  Either trust the engine to capture the right 
things (the new syntax proposed here) or explicitly list everything (the 
existing syntax we've had since 5.3.)
* We added a section discussing the `use(*)` syntax alternative, and why it 
wasn't, er, used.  (Pun only sort of intended.)

--Larry Garfield

Hi,

Would it be an option to include a "Future scope" with the features:
- Explicit capture that list only the variables to be captured by value or reference, nothing else. - Extending the traditional anonymous function with use(*) for capturing everything.

Anyway, hope this passes for PHP 8.2!

Regards //Björn Larsson

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

Reply via email to