Copying a discussion from the roadmap thread per suggestion from @Lantua:
If these accesses are disallowed, from the "First Phase: Basic Actor Isolation" example in the roadmap thread:
// error: an actor cannot access another's mutable state
otherActor.mutableArray += ["not allowed"]
// error: either reading or writing
print(other.mutableArray.first)
What is the meaning of mutableArray
being declared internal
?
I see how this proposal adds an axis beyond access control—mutableArray
is restricted even beyond what private
would signify:
synchronous functions may only be invoked by the specific actor instance itself, and not even by any other instance of the same actor class.
(my emphasis)
What I am wondering is if these axes are orthogonal: is it at all meaningful that mutableArray
is internal
here? I'm not sure that access control modifiers really matter at all for actor state. Perhaps they would matter if the state was annotated @actorIndependent
? I wonder if the language or the developer tools might clarify this at all.