Am 25.03.2021 um 17:25 schrieb Larry Garfield <[email protected]>:
> So in conclusion, it seems the reasons closures weren't auto-capture always 
> were:
> 
> 1) Possible performance concerns that are no longer relevant.
> 2) Avoid surprise references.
> 3) Allow users to capture by value or by reference.
> 
> Point 1 is no longer relevant as the engine has changed so much.
> Point 2 is no longer relevant since forever, since capture is by-val by 
> default.
> Point 3 is only relevant in the cases where you need to capture by reference, 
> which in practice it turns out are really quite rare.
> 
> So, I would argue that all of the reasons for manual capture in the first 
> place are no longer relevant, except in the edge case where you really do 
> want to capture by reference.

While the discussion back then revolved a lot around performance and references 
I don't think

4) Local-as-default scoping and explicit captures are the PHP way and make it a 
better language

which was mentioned in this thread should be buried ;-)

- Chris

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

Reply via email to