Re: [RFC] Auto-capture multi-line closures andshortfunctions take 2
| From: | Matthew Brown | Date: | Thu, 25 Mar 2021 16:55:21 +0000 |
| Subject: | Re: [RFC] Auto-capture multi-line closures andshortfunctions take 2 | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-113786@lists.php.net to get a copy of this message | ||
On Thu, 25 Mar 2021 at 12:24, Nuno Maduro <enunomaduro@gmail.com> wrote:
> Hi,
>
> Concerning the comments about what's exactly "auto-captured" by the scope
> of a multi-line short closure, we will be just reusing the "auto-capture"
> feature that already exists in one-line short closures. Therefore, this RFC
> doesn't have plans on changing the way "auto-capture" already works in PHP.
>
Absolutely, but allowing assignments in short closures increases their
complexity, and thus (in my opinion) erases the advantage of auto-capturing.
I know you can _also_ have assignments in short closures (because
assignments are just expressions in PHP), but it's much harder to come up
with short closure gotchas.