`nonisolated lazy let` on an actor

Custom actor executors will add an interesting twist to this. It's an immediate consequence of the feature that actors will be able to share a serial executor, which as far as the dynamic runtime is concerned means they share isolation. However, as long as the compiler doesn't understand that relationship statically, it will continue to enforce isolation between them, and you'll even have to await when calling between them (but it won't ever dynamically suspend). So whether or not two actors share a serial executor will not affect source and should just have performance implications. If we then add a way to make actor instances statically share isolation, that would allow awaits to be dropped, Sendable checks to be avoided, etc., basically making them the same isolation domain in all phases. But that's not an immediate consequence of adding custom actor executors.

4 Likes