[Pitch #2] Structured Concurrency

Jumped from the quoted thread.

As is, Task APIs, e.g. Task.isCancelled requires the caller to be an async function, but Continuation is used only on non-async function.

AFAICT, to allow the Task -related usage in continuation block, we need to either

  • Make Task API works on any non-async function, or
  • Provide Task.Handle to the continuation block,
  • Copy all Task functionality onto UnsafeContinuation , turn them into non-async version (since we now know which Task it is referring to).