Swift has finally matured enough to tackle the subject of enhanced concurrency language features. In this regard the language author; Chris Lattner has drafted the 1st revision of what these enhanced features could be and how they would functional internally with Swift, interoperable with C and Objective-C API and Automatic Reference Counting (ARC).
Concurrency manifesto:
Note: click on the headings for links to the proposals
Concurrency manifesto:
- This document covers the broader topic of adding task based concurrency as a first class inclusion to the language; that being not only the implementation of these concurrency enhancements, but also to how they would syntactically integrate in the language, how they would work with ARC and the C / Objective-C interops.
- Primary focus areas are; asynchronous control flow, message passing and data isolation & distributed data and compute -- the key exclusion for the moment being data paralleism (yet some ideas on that are discussed in part 5)
- Two key implementations are envisaged;
- Asynchronous control flow to follow the C# Async / Await approach with the exception that the return types are not wrapped up as Futures (C# calls its Future's implementation: Tasks) i.e. function returns type to remain unchanged. Whereas a Future type is seen to be a separate feature; but the discussion does extend to how this could be incorporated as a language feature; but it's not a priority as Swift already has many 3rd party / Opensource implementations of this and more.
- The second relates message passing, data isolation and distributed data & compute. In that area it is envisaged to follow the Actor model which is not only a deeply researched area, but has many successful implementations from which ideas can be adapted / improved upon; for example: in Erlang, Scala & Pony. This will venture into both interprocess communication and distributed computing.
- In addition to the manifesto, a proposal has been drafted for task based async control flow: Async / Await -- which could imply implementation in the latter part of this year as part of the Swift 5 roadmap.
Note: click on the headings for links to the proposals
Last edited: