Hello, Swift community.
The fourth review of SE-0304: Structured Concurrency begins now and runs through July 14th, 2021.
Following on from the third review, the proposal authors have made a number of changes. The full history of changes made after each review can be found at the end of the proposal, and the full diff can be found here.
Below is a summary of the changes from the prior review. The core team would like to narrow the focus of this fourth review on these areas:
- renamed
Task.sleep(_:)
toTask.sleep(nanoseconds:)
. This makes it clear that the wait is in nanoseconds, and leaves API space open for asleep(_:)
based on a better duration type in the future. - made
Task.sleep(nanoseconds:)
throwing; it will throwCancellationError
if the sleeping task was cancelled. - renamed
TaskGroup.async
andTaskGroup.asyncUnlessCancelled
toTaskGroup.addTask
andTaskGroup.addTaskUnlessCancelled
. The fundamental behavior here is that we're adding a task to the group.add
by itself does not suffice, because we aren't adding a value (accessible vianext()
), we are adding a task whose value will be accessible vianext()
. It also parallels the use ofTask { ... }
to create top-level tasks. - renamed
TaskPriority.default
toTaskPriority.medium
, becausenil
passed in to aTaskPriority?
parameter is effectively the default for most APIs. - added
TaskGroup.waitForAll
andThrowingTaskGroup.waitForAll
. - renamed
Task.yield()
toTask.suspend()
, which more accurately represents what this operation action does, and leaves the name "yield" for future work on generators.
This review is part of the large concurrency feature, which we are reviewing in several parts. While we've tried to make it independent of other concurrency proposals that have not yet been reviewed, it may have some dependencies that we've failed to eliminate. Please do your best to review it on its own merits, while still understanding its relationship to the larger feature. You may also want to raise interactions with previous already-accepted proposals – that might lead to opening up a separate thread of further discussion to keep the review focused.
Reviews are an important part of the Swift evolution process. All review feedback should be either on this forum thread or, if you would like to keep your feedback private, directly to the review manager. If you do email me directly, please put "SE-0302" somewhere in the subject line.
What goes into a review?
The goal of the review process is to improve the proposal under review through constructive criticism and, eventually, determine the direction of Swift. When writing your review, here are some questions you might want to answer in your review:
- What is your evaluation of the proposal?
- Is the problem being addressed significant enough to warrant a change to Swift?
- Does this proposal fit well with the feel and direction of Swift?
- If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
- How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
More information about the Swift evolution process is available at:
https://github.com/apple/swift-evolution/blob/master/process.md
As always, thank you for contributing to Swift.
Ben Cohen
Review Manager