SE-0304 (3rd review): Structured Concurrency

As a meta-review, I really appreciate the detailed change-log. It really helps catching up to the current state of the proposal, especially if you got off midway somewhere.

3 Likes

I I've been brooding over this for a while, and I still think that TaskGroup should cancels all of it's child tasks at the end of the body regardless of how it finishes (throwing vs non-throwing).

Firstly, note that we can override the default behaviour by calling group.cancellAll() or while true { await group.next() }, so it's more of the preference and has no impact on the expressibility.

There are a few reasons I prefer cancellation for all exits, even if the body doesn't throw.

  • It makes the system much easier to explain (unused child tasks are cancelled).

  • It would help the task group finishes earlier if the child tasks are cooperative, which is roughy the point of the cancellation.

  • Furthermore, I believe it's more common for unused child tasks to be easily discardable and has no side effect.

    Again, if it is important that the task finishes, it's more likely that async {} or Task.detach are better for such jobs.

4 Likes

Review Continuation

This proposal has been revised and a fourth review has been initiated.

2 Likes