We've been revising the Structured Concurrency pitch document a bit to try to explain more about the design goals and fill in some gaps based on the discussion in the first pitch thread. Here's a list of the changes in this second pitch document:
- Added a "desugaring" of
async letto task groups and more motivation for the structured-concurrency parts of the design.
- Reflowed the entire proposal to focus on the general description of structured concurrency first, the programming model with syntax next, and then details of the language features and API design last.
- Reworked the presentation of the Task APIs with more rationale for the design.
- Added more discussion of why futures aren't more prominent.
- "Task nursery" has been replaced with "task group".
- Added support for asynchronous
@mainand top-level code.
- Specify that
tryis not required in the initializer of an
async let, because the thrown error is only observable when reading from one of the variables.
withUnsafe(Throwing)Continuationfunctions have been moved out of the
- Note that an
async letvariable can only be captured by a non-escaping closure.
- Removed the requirement that an
async letvariable be awaited on all paths.
The latest draft is available here.