Dynamic Actor Isolation Can Help During the Transitional Phase
Making just one type
@MainActor
can result in cascade of errors at all usage sites where the compiler now cannot provide thatMainActor
guarantee. This virality can make it really hard to incrementally adopt concurrency with targeted changes. Perhaps that’s not too big a deal for smaller code bases/teams, but I bet this is a killer for big projects. So what do you do?You make use of dynamic isolation to contain the spread!
Instead of throwing (static) type annotations around, you can ease into the adoption of actor isolation with (dynamic) preconditions and running blocks of structured and unscructured concurrent code.