3 ms·
That “public private(set)” boggles my mind. Why not “readonly public”?
by PaulHoule 2y ago
That “public private(set)” boggles my mind. Why not “readonly public”?
- wvenable 2y agoReadonly might have different semantics (as it does in C#). Readonly has been discussed but it wasn't part of the property hooks RFC and is a separate issue/feature. This is just a natural consequence of having private setters.
- bwoebi 2y agoreadonly is rather a misnomer for "writeonce" in PHP. And as such it also disallows repeated assignment in class scope, while private(set) has no such restriction.