`@isolated(any)` function types

Just thought about how we currently don’t infer isolation for async let like these while chatting with @hborla:

async let a = actor.do()
async let b = actor.undo()

in today’s world those are — same as Task{} — enqueued to the global pool first, and then hop to the actor, causing opportunity for re-ordering to happen.

If we can now make the implicit closure of async let be @isolated(any) and notice that the first call immediately hops off, we could avoid making the enqueue to global.

2 Likes