Re: [RFC] Readonly property hooks
| From: | Nick | Date: | Fri, 11 Jul 2025 04:30:43 +0000 |
| Subject: | Re: [RFC] Readonly property hooks | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-128002@lists.php.net to get a copy of this message | ||
Hey all,
> On 8. Jun 2025, at 11:16, Larry Garfield <larry@garfieldtech.com> wrote:
>
> As Nick has graciously provided an implementation, we would like to open discussion on this
> very small RFC to allow
readonly on backed properties even if they
> have a hook defined.
>
> https://wiki.php.net/rfc/readonly_hooks
>
> --
> Larry Garfield
> larry@garfieldtech.com
To not get this buried in individual answers to others:
I came up with two alternative implementations which cache the computed get hook value.
One leverages separate cache properties, the other writes directly to the backing store.
Links to the alternative branches can be found in the description of the original PR.
https://github.com/php/php-src/pull/18757
I believe that these are fair solutions to address the concerns that came up in the discussion, and
I hope people will agree.
Cheers,
Nick