SE-0300: Continuations for interfacing async tasks with synchronous code

By having fewer API variants, I find them easier to learn and use. I was also trying to limit top-level Unsafe* and withUnsafe* APIs, for better auto-completion of the existing pointer APIs.

I now understand your concern, but that wasn't my intention. My earlier example uses try result.get() immediately.


Could this be improved by adding a static suspend method to each continuation type?

try await UnsafeThrowingContinuation.suspend { continuation in
  /* ... */
  continuation.resume(returning: value)
}
5 Likes