[Pitch #2] Structured Concurrency

Perhaps. By introducing this here, where we have several APIs that would make use of it, its use and meaning would be self-explanatory.

Isn't "instantaneous" synonym with "synchronous" here? It feels like @instantaneous and async are cancelling each other, like matter and anti-matter.

If we mean "synchronous but needs a task context" maybe we could just omit async and name the attribute so it signals the task context requirement:

@taskLocal func isCancelled() -> Bool { ... } 

And perhaps getting rid of async could allow isCancelled to be a property:

@taskLocal var isCancelled: Bool { ... } 

which would fell more natural.

And then people will do this:
@taskLocal var traceID: Int { Task.local(\.traceID) }

but that's probably a topic for the other pitch.

10 Likes