> Le 17 juin 2022 à 00:46, Ilija Tovilo <tovilo.il...@gmail.com> a écrit :
>
> (...)
>
> Since the primary motivation of this RFC is to allow fetching the name
> and value properties of enums I'm inclined to forbid using -> on
> anything but enums. That would circumvent the issue since enums can't
> contain user-defined properties nor the magic __get method, and
> name/value are readonly.
>
> I'll take a few days to think about the options, and will update the
> RFC and inform the mailing list about the decision I have made. Let me
> know if you have any more thoughts.
>
Hi,
I feel that, in any case, allowing unrestricted fetching properties in const
expression in is semantically incorrect, because properties are fundamentally
mutable. I am not speaking of creative use of code in order to achieve the
effect, but of the regular semantics of properties.
For me, it seems reasonable to restrict the feature to readonly properties
(including those of enums), because those are effectively immutable by design.
—Claude
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php