Idea: Properties

When I said read-only I've meant shared (with interior mutability as usual). A new kind of immutability would be a big change to the language, and shouldn't be introduced just as a side effect of another feature.

@repax suggested exposing fields via a trait object pub(as &dyn Trait). That would be a very powerful method of controlling access, since even types that have interior mutability could be type-erased and presented in a truly read-only way.

4 Likes

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.