Closed riaqn closed 1 week ago
I went to review, but actually I don't know what the specification of this PR is. There have been lots of designs floated around mutability modes. What's the one we're going with? It might be helpful just to make a small diff to the doc, which can then help me review the rest.
@goldfirere I've amended the description. WRT document - I imagine this is a short-term workaround so we probably don't need to document that?
Happy with new tests. Merge when ready.
This PR recognizes
[@no_mutable_implied_modalities]
on mutable fields, so that the modalitiesglobal many shared
will not be implicited applied.EDIT: a bit of context: In the old days,
mutable
impliesglobal many shared
modalites. This is needed to prevent (for example) a pointer from global to local.2369 refines the type-checking. In particular, it allows constructing a
local
record from alocal
mutable field. On the other hand, mutable field projected out of alocal
record can only belocal
, as opposed toglobal
provided by theglobal
modality. Much existing code relies on that old behaviour, and as a result #2369 still makesmutable
imply the modalities just for compatibility.But in the long run we want to remove the coupling. This attribute allows individual mutable fields to opt out of the coupling, so that programmers can experiment with the new behaviour of
mutable
.