Right. Actors are the mechanism for consistently serializing access to state. Global actors so that for global/static variables. Actor classes do that for their instance variables.
I don’t quite agree with this assessment. You can use async/await in the same places you use completion handlers today, and it improves that code. But you still have the same data races that you have today in concurrent code. You need actors to start making things safe from data races.
This is why global actor annotations can be placed on types and extensions and such, to reduce the annotation burden. But yes, this is an issue.
Most code is expected to be actor-independent, in the sense that it doesn’t care what actor it is running on, because it won’t refer to global state anyway. There’s no reason these need annotation.
Yes. To be clear, actors themselves are not that complicated in the user model. They’re like a class that’s more picky about self.
This isn’t that different from calling an async function with no actor annotation, is it? You can yield if you want to let other code run on your current actor.
Doug