[Concurrency] Continuations for interfacing async tasks with synchronous code

Nothing is being ignored, it has nothing to do with this specific API, so there's no reason to cram in more complexity into it.

Through composition with APIs proposed in structured concurrency, it is able to handle cancelation when necessary, exactly like @jayton suggests (that's one of the ways):

Note that since you're in an async function already (in download), you can normally Task.isCanceled check before submitting any work as well.

Please refer to [Pitch #2] Structured Concurrency - #116 by ktoso for more details on structured concurrency and those APIs; If we made Task a value, then the insides of the continuation can check for it: task.isCanceled as well.

3 Likes