Hi

On 7/10/25 17:34, Larry Garfield wrote:
Nick previously suggested having the get-hook's first return value cached; it 
would still be subsequently called, so any side effects would still happen (though 
I don't know why you'd want side effects), but only the first returned value would 
ever get returned.  Would anyone find that acceptable?  (In the typical case, it 
would be the same as the current $this->foo ??= compute() pattern, just with an 
extra cache entry.)

I'm seeing this proposal has already been dropped, but to spell it out explicitly:

No, I would not find it acceptable for side effects to happen once again, but the return value ignored.

And when dropping the "side effects run once again" part, you arrive at an 'init' hook, which I would be in favor of, since it would provide semantics that are sound with regard to user expectations.

"Cached get" is just init with extra confusion.

Best regards
Tim Düsterhus

Reply via email to