Cannot understand the nature of data race warnings in Swift 5.10

Seems like I've been missing on important piece and understood async functions behaviour incorrectly. Thanks, this proposal has clarified some details for me!

So in the way I am using it in this particular case, this isolation of B on A is what I need. And if I do not want to make it isolated on the actor, I need it to be sendable, since it is possible to create two tasks that call A.prepare and therefore access B which is not safe to access in that way, is that correct?

With that so far I have the least understanding on an options to approach... I would prefer List to be not isolated on a certain actor by design, but rather specify this isolation later. So far it has been possible to achieve this by this implementation I provided, not in obvious way, but it worked. Now I understand why it is not working that way anymore after reading the proposal, yet have no idea how to change it without binding List to the (main or any other global) actor?

1 Like