SE-0304 (2nd review): Structured Concurrency

I–personally–really dislike that await x.get() pattern and secretly wish for a re-throwing protocol like this:

protocol Awaitable { 
  associatedtype T: Sendable
  func get() async rethrows -> T (?) 
}

and writing:

await x // equivalent to await x.get()

but so far it hasn't been critical to introduce this sugar. Partially it was argued that "detach (and therefore Task.Handle) is bad and should be ugly" but maybe this is a thing to consider still?

To be honest this feels like one of those things we can add later once we gained more experience and know how often handles really do show up.

// This of course is inspired by how .NET has it: Asynchronous Operations: Awaitables though the exact semantics are just slight sugar for the get for us.

2 Likes