Re: RFC: Support Closures in constant expressions
| From: | Larry Garfield | Date: | Wed, 30 Oct 2024 04:25:55 +0000 |
| Subject: | Re: RFC: Support Closures in constant expressions | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-125874@lists.php.net to get a copy of this message | ||
On Tue, Oct 29, 2024, at 10:11 AM, Tim Düsterhus wrote:
> Hi
>
> Volker and I would like to start discussion on our RFC to "Support
> Closures in constant expressions".
>
> Please find the following resources for your reference:
>
> - RFC: https://wiki.php.net/rfc/closures_in_const_expr
> - Implementation: https://github.com/php/php-src/pull/16458
>
> Best regards
> Tim Düsterhus
This seems like a good idea to me. My only real question is why we need to forbid short-closures.
I fully agree that capturing variables for such functions doesn't work. What I don't
understand is why that precludes short-closures. Is it not possible to "just" say
"there's nothing to even capture in this context, don't try"? (There may be
technical reasons for that, but I do not know what they are and the RFC doesn't say.)
--Larry Garfield