Re: Brainstorming idea: inline syntax for lexical (captured) variables
| From: | Rowan Tommins | Date: | Thu, 13 Apr 2023 15:19:47 +0000 |
| Subject: | Re: Brainstorming idea: inline syntax for lexical (captured) variables | ||
| References: | 1 2 3 4 5 6 7 8 9 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-120031@lists.php.net to get a copy of this message | ||
On Thu, 13 Apr 2023 at 13:40, Nicolas Grekas <nicolas.grekas+php@gmail.com>
wrote:
>
> I created this draft RFC to help move things forward:
>
>
> https://wiki.php.net/rfc/syntax-to-capture-variables-when-declaring-anonymous-classes
>
> Please let me know your early thoughts and I'd be happy to move it to
> "under discussion".
> I'd also need someone for the implementation as I doubt I'll be able to
> write it myself in a reasonable time!
>
Hi Nicolas!
Thanks, it's really encouraging to have some interest in the feature.
The good news is that I have an implementation of this nearly ready (it
passes all my tests, but the code's a bit messy). I was hoping to polish it
over the Easter weekend and draft a PR, but wasn't feeling very well.
It has full support for visibility, types, references, and property
renaming, but no merging of parameter lists or automatic call to the parent
constructor. I think with clean errors that's a good first feature set, and
if someone comes up with an implementation for manipulating existing
constructors, that can be proposed later.
So, "watch this space", as the saying goes :)
Regards,
--
Rowan Tommins
[IMSoP]