We've prepared another revision of the Structured Concurrency proposal. Here is the current revision:
Here was the revision at the time this thread was started: swift-evolution/nnnn-structured-concurrency.md at eb149799aac93b3fb84a97adb2bb3db47179a21b · DougGregor/swift-evolution · GitHub
Relative to the previous pitch, we've made the following further changes in response to feedback:
- Factored out the
async let
sugar and thewith*Continuation
APIs into their own proposals. - Added discussion about where newly spawned child and detached tasks run, tying into the recent pitch about executors.
- Clarified the semantics of
withCancellationHandler
, and added an example of its use (thanks to @jayton) - Revised the static APIs on
Task
to be non-async
, so that they are also available tonon
-async code when running on behalf of a task, as well as the ability to getTask
instances representing other tasks, and anUnsafeCurrentTask
object that can be used within the current task to access its state. -
Task.Group
now conforms to theAsyncSequence
protocol to allowfor await
loops to iterate through the results of child tasks. - Adopted the
@concurrent
attribute for closures where appropriate in APIs likeTask.runDetached
andTask.Group.add
.
Thanks for all of your ongoing feedback, everyone!