Why is a Task closure defined in an Actor's method nonisolated?

Yeah, the conditional nature of @_inheritActorContext has surprised and confused many people. There is a non-conditional variant, @_inheritActorContext(always), however that isn’t what the task initializers use.

It has taken a while, but I still believe this is an area of the language that will be improved.

While I do find myself doing it less and less these days, I usually just use print("actor:", #isolation) directly.

1 Like