Re: [PHP-DEV] [RFC] Readonly property hooks

2025-07-13 Thread Ilija Tovilo
Hi Nick On Fri, Jul 11, 2025 at 6:31 AM Nick wrote: > >> On 8. Jun 2025, at 11:16, Larry Garfield wrote: >> >> https://wiki.php.net/rfc/readonly_hooks >> >> To not get this buried in individual answers to others: > > I came up with two alternative implementations which cache the computed `get`

Re: [PHP-DEV] [RFC] Readonly property hooks

2025-07-13 Thread Eric Norris
> Well, I don’t know. Everyone seems to think of init hooks (and their playing > together with other hooks) differently. > Some say this, some say that. That’s the exact issue. Want an example? > > Eric just agreed with your code example which has a get hook AND init hook. > > ``` > class Test { >

Re: [PHP-DEV] [RFC] Readonly property hooks

2025-07-13 Thread Nick
> On 14. Jul 2025, at 01:15, Eric Norris wrote: > > On Sun, Jul 13, 2025 at 2:00 PM Marc Bennewitz wrote: >> >> >> On 13.07.25 18:17, Nick wrote: >> >> >> On 13. Jul 2025, at 20:38, Marc Bennewitz wrote: >> >> Hi Nick, Claude, >> >> Hey Marc, >> >> I think it's important to explicitly m

Re: [PHP-DEV] [RFC] Readonly property hooks

2025-07-13 Thread Eric Norris
On Sun, Jul 13, 2025 at 2:00 PM Marc Bennewitz wrote: > > > On 13.07.25 18:17, Nick wrote: > > > On 13. Jul 2025, at 20:38, Marc Bennewitz wrote: > > Hi Nick, Claude, > > Hey Marc, > > I think it's important to explicitly mark it as "this value will be stored in > memory", I mean just silently c

Re: [PHP-DEV] [RFC] Readonly property hooks

2025-07-13 Thread Marc Bennewitz
On 13.07.25 18:17, Nick wrote: On 13. Jul 2025, at 20:38, Marc Bennewitz wrote: Hi Nick, Claude, Hey Marc, I think it's important to explicitly mark it as "this value will be stored in memory", I mean just silently caching the get hook could quickly lead to unexpected behavior. Like on

Re: [PHP-DEV] [RFC] Readonly property hooks

2025-07-13 Thread Nick
> On 13. Jul 2025, at 20:38, Marc Bennewitz wrote: > Hi Nick, Claude, Hey Marc, > I think it's important to explicitly mark it as "this value will be stored in > memory", I mean just silently caching the get hook could quickly lead to > unexpected behavior. Like one would expect the value to be

Re: [PHP-DEV] [RFC] Readonly property hooks

2025-07-13 Thread Marc Bennewitz
On 11.07.25 11:38, Nick wrote: On 11. Jul 2025, at 14:25, Claude Pache wrote: Le 11 juil. 2025 à 06:30, Nick a écrit : 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

Re: [PHP-DEV] RFC: Records

2025-07-13 Thread Nick
> On 17. Nov 2024, at 06:14, Rob Landers wrote: > > Hello internals, > > I'm ready as I'm going to be to introduce to you: "Records" > https://wiki.php.net/rfc/records! > > Records allow for a lightweight syntax for defining value objects. These are > superior to read-only classes due to hav