[Pitch] Region Based Isolation

Your contrived example will technically compile under this proposal, but remember that iterator is in the same region as stream and all of its results that are non-Sendable; if you do anything to merge the stream or the results into the actor's region -- such as using a parameter in the expression that initializes stream or storing one of the results into a variable that's already in the actor's region -- then the compiler must assume that the actor can reference iterator. In order to fully solve the Sendable issues with AsyncSequence iterators, I believe we need the future direction of this proposal to specify that a result value is disconnected, and then annotate both makeIterator() and next() with that attribute.

Yes, that's correct!

4 Likes