Re: Allow hooks in `readonly` promoted properties
Hey all,
> On 4. Jun 2025, at 01:03, Larry Garfield <larry@garfieldtech.com> wrote:
>
> It's about expectation setting. If you see a property marked readonly,
> it's reasonable to expect this to be true:
>
> $foo->bar == $foo->bar;
>
> For a traditional field (pre-hooks), this would be trivially true. With hooks, it may or may
> not be. Saying "well, that assumption doesn't hold anymore, deal" is certainly an
> option, but it's not an option we wanted to pursue as part of the larger RFC. But that is
> certainly a direction we could take.
Larry, I understand now that you in fact explicitly talk about random_int().
Previously, I did not. I was more on the “manipulating in general” meta level.
Fair. If someone really wants to add random_int(): "well, that assumption doesn't hold
anymore, deal” from my side.
>> So, I would love to see this RFC to be implemented.
>> Maybe you want to move it to discussion? Then my separate thread here
>> would be obsolete.
>
> I believe at the moment that RFC text is all there is. :-) I don't know that it's
> worth opening a discussion without at least a mostly-done implementation. Also, Ilija is rather
> busy on other tasks at the moment, as am I. (Unless someone else wants to jump in to implement it,
> which would be fine.)
People often say “you can just do things”. So I did, and tried to contribute the code for your
existing RFC text:
https://github.com/php/php-src/pull/18757
Can it really be such a little change? I’d appreciate feedback from people more experienced than I
am. Thanks!
Cheers,
Nick
Thread (14 messages)