Re: RFC [Discussion]: Closure self-reference
| From: | Erick de Azevedo Lima | Date: | Tue, 06 Jun 2023 21:51:31 +0000 |
| Subject: | Re: RFC [Discussion]: Closure self-reference | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-120537@lists.php.net to get a copy of this message | ||
Hello you all.
As closures are objects, I'd be ok with $this->__invoke(), but it's not
possible because closures can be bound to other contexts.
From the proposed solutions, the one that makes more sense to me is the
__CLOSURE__, because not only it does not need
the boilerplate that can be confusing about the usage of "use/as" but it
also shouts out for the ones reading the code that this
function is calling itself.
Best regards,
Erick
Em ter., 6 de jun. de 2023 às 11:26, Bruce Weirdan <weirdan@gmail.com>
escreveu:
> On Sat, Jun 3, 2023 at 9:11 PM Dan Ackroyd <Danack@basereality.com> wrote:
> > I'm now opening the discussion for the Closure self-reference RFC:
> > https://wiki.php.net/rfc/closure_self_reference
>
> Looking at the syntax options on the RFC page, the following
> explanation is not clear to me:
>
> > * De-anonymize the function. This has a large aesthetic downside of
> appearing to create the closure variable in the scope that the closure is
> declared in, rather than internal to the closure scope.
>
> Does this mean that the variable wouldn't actually be created in the
> enclosing scope, but someone may *think* it would?
>
>
> --
> Best regards,
> Bruce Weirdan mailto:
> weirdan@gmail.com
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: https://www.php.net/unsub.php
>
>