Re: RFC: First Class Callables in constant expressions
| From: | Rob Landers | Date: | Sun, 02 Feb 2025 14:35:12 +0000 |
| Subject: | Re: RFC: First Class Callables in constant expressions | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-126272@lists.php.net to get a copy of this message | ||
On Wed, Jan 22, 2025, at 15:35, Tim Düsterhus wrote:
> Hi
>
> Volker and I would like to start discussion on our RFC to support "First
> Class Callables in constant expressions".
>
> Please find the following resources for your reference:
>
> - RFC: https://wiki.php.net/rfc/fcc_in_const_expr
> - Implementation: https://github.com/php/php-src/pull/17213
>
> - The related "Support Closures in constant expressions" RFC:
> https://wiki.php.net/rfc/closures_in_const_expr
> - The "Support Closures in constant expressions" discussion:
> https://externals.io/message/125872
>
> Best regards
> Tim Düsterhus
>
Hey Tim,
My only concern with the RFC is something a bit silly. If I understand correctly, this will be a
constant expression:
fn(string $foo) => print $foo
But this will not:
(fn(string $foo) => print $foo)(...)
despite them both basically being the same thing.
It is an incredibly small inconsistency (imho), but other than that, ship it.
— Rob