Concrete proposal for async semantics in Swift
| Originator: | Oleganza | ||
| Number: | rdar://21493275 | Date Originated: | 23-June-2015 |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | |
| Classification: | Reproducible: |
There's already a radar 5633354 covering coroutines/actors/async model. Inspired by your enhancement in error handling I decided to write up a concrete proposal on how async semantics can be added to Swift with full backwards compatibility and automatic optional conversion of ObjC APIs. Full specification is here: https://gist.github.com/oleganza/7342ed829bddd86f740a TL;DR: instead of forcing any specific execution model, or making explicit syntax for handling "promises", we introduce a syntactic layer for managing nested blocks. Basically, the Swift compiler would rewrite the clean linear code into spaghetti of multiple blocks like we have to do manually today. The proposal covers interoperability with error handling syntax, `defer`, `guard` and interoperability (both ways) with classic block-based APIs.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!