Hello, Swift Evolution
The review of SE-0493: Support async calls in defer bodies has concluded, and the Language Steering Group had decided to accept the proposal.
The review discussion covered two main design decisions in the proposal. First, reviewers discussed whether the feature should require additional syntax, such as the defer statement requiring an explicit async keyword, rather than only requiring await at potential suspension points in the body. The LSG believes that writing await in the defer body is sufficient; scope exists already have implicit suspension points due to async let, and other statements can have async work done in the body without additional syntax on the statement itself.
Reviewers also discussed whether defer should suppress task cancellation, since cleanup work that should always run is typically written in defer statements. The LSG believes that because defer is a syntactic convenience, it should not be load bearing on the semantics of the code that runs inside of the body, and the task cancellation behavior should be consistent between synchronous and asynchronous defer statements.
As always, thank you to everyone who participated in the pitch and proposal review. Your contributions help make Swift a better language.
Holly Borla
Review Manager