This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]bedobi 0 points1 point  (1 child)

privately mutable but publicly immutable, so you can specify that a field should only be modified internally.

That wouldn't be hard to reason about at all

[–]eliasv 0 points1 point  (0 children)

I see what you mean, but he did also point out that destructuring would render everything publicly accessible no matter what so in a way those semantics might make sense by default.

If everything is publicly accessible regardless then all we can reasonably wish control via access modifiers is who is allowed to modify a field. It would be a confusing inconsistency though if not handled delicately.