Am 24.03.2021 um 18:15 schrieb Chase Peeler <chasepee...@gmail.com>:
> I guess my one question would be why we didn't support auto-capture when we
> first implemented anonymous functions, and if there was a reason, why does
> that no longer apply?

My guess would be that it was seen as one of PHP's big strength that variables 
don't just leak into other contexts but that it has to be done explicitly.

Now with arrow functions both the benefit of auto-capturing is bigger compared 
to the actual function 'body', it normally only spans a line or two and (for me 
personally) the absence of {} also kind of make the leakage fit my mental model 
more easily.

For these reasons I think I lean towards -1 for both 
https://wiki.php.net/rfc/short-functions 
<https://wiki.php.net/rfc/short-functions> and 
https://wiki.php.net/rfc/auto-capture-closure 
<https://wiki.php.net/rfc/auto-capture-closure> as they add more syntax without 
(IMHO) a huge benefit.

You might be able to convince me otherwise though ;-)
- Chris

Reply via email to