Hey Eric, > On 11. Jul 2025, at 10:08, Eric Norris <eric.t.nor...@gmail.com> wrote: > > Regarding the caching option suggested elsewhere, the semantics > mentioned seem confusing to me. The body is called on subsequent gets, > but only the value from the first get is returned? I would expect that > would be very confusing to developers. If the body wasn't executed on > subsequent invocations that might make more sense to me, but then the > get hook essentially is an init hook, and why not call it as such.
I just before pushed a third implementation idea which addresses this. It also no longer requires a separate cache. It uses the store itself. A link to the branch is in the description of the original PR. > Also, just to throw the idea out there - maybe start with init hooks > *only* for readonly properties? Is there something to this, especially > if you consider "readonly" actually "writeonce"? Maybe this plus > disallowing set hooks? Personally, I don’t see added value in adding yet another hook `init`. I also don’t see how this would solve the `get` hook issue? As a user I want to be able to have a `get` hook in readonly classes. For instance, for formatting. In my last answer to Tim I showed an example of what I would expect from `readonly` properties. Cheers, Nick