On Fri, 2025-07-18 at 11:49 -04:00, Rob Landers <rob@bottled.codes> wrote: > On Fri, Jul 18, 2025, at 17:25, Tim Düsterhus wrote: >> A readonly class is not just a convenience shortcut to mark each >> individual property as readonly. It has important semantics of its own, >> because it forces child classes to also be readonly. And even for final >> classes it communicates to the user that "I won't be adding non-readonly >> properties to the class". > > Wasn’t that the entire point of readonly classes? Because it was painful to > write readonly for every property. Then if a property is readonly, the > inherited property is also readonly, so, by extension: a class extending a > readonly class is also readonly. > > There’s no “communication” here; just logic.
All code is communication, not just to the computer, but to other humans reading it. This is why the semantics of the terms are important. I agree with Tim's interpretation of those semantics, and hence vastly prefer an init hook to get in these circumstances. Importantly, this RFC can clarify the semantics of these terms for the language as a whole. That specific meaning can be documented. If a proposal does not come from a principled understanding of what `readonly` means - what it indicates to users of the class - I think that is a step backwards. mjec