Re: Re: [RFC] Readonly property hooks
| From: | Claude Pache | Date: | Sat, 19 Jul 2025 01:04:08 +0000 |
| Subject: | Re: Re: [RFC] Readonly property hooks | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-128130@lists.php.net to get a copy of this message | ||
> Le 19 juil. 2025 à 00:41, Rob Landers <rob@bottled.codes> a écrit :
>
> The original author (Nikita) suggested that there's nothing in the original design that
> precludes accessors -- and highlights languages where there are both and they are doing just fine
> more than 5 years later.
Hi Rob,
It is indeed entirely reasonable to have both readonly properties and hooked properties (aka
accessors), and today PHP has indeed both of them (and even asymmetric visibility on top of that, as
a separate feature contrarily to C#). But it doesn’t mean that it is reasonable for the *same*
property to be *both* readonly and hooked, which is the point that is currently disputed. — What
do the other languages allow? Is it possible to define a readonly property with a user-defined
getter? (Disclaimer: Even if one of them allows such a thing, I’ll still think that it is a bad
idea.)
—Claude