Menu
Concurrency model proposed for Swift language

Concurrency model proposed for Swift language

'First-class’ concurrency model would make asynchronous programming in Swift convenient, efficient, and safe, according to a roadmap outlining the plan

Credit: Dreamstime

Plans are afoot to outfit Apple’s Swift language with a “first-class” concurrency model. The goal is to make concurrent programming in Swift efficient, safe, and convenient, according to the roadmap published at forums.swift.org.

Swift concurrency is intended to prevent data races on mutable state by default, through the implementation of asynchronous functions and actors. These will be introduced in two phases, first by bringing in the ability to create async functions and actors, and then by enforcing full actor isolation.

The end state of the proposed changes would do the following:

  • Eliminate data races and deadlocks in the same way Swift eliminates memory unsafety
  • Make asynchronous programming convenient and clear at its point of use
  • Provide a standard set of language tools and techniques that developers can follow
  • Improve performance of asynchronous code through better knowledge at compile time

The introduction of these features would span multiple Swift releases. The first phase, introducing the async syntax and actor types, would allow users to organise code around actors in such a way that would reduce but not eliminate data races.

The second phase, which would enforce full actor isolation, would eliminate data races. It also would offer features allowing efficient, ergonomic interoperation of actors needed to make the isolation practical.

Specific proposals for the first phase include:

  • Introduction of a coroutine-based async/await model to Swift
  • Task API and structured concurrency, introducing the concept of a task to the standard library
  • Actors and actor isolation, describing the actor model that provides state isolation for concurrent programs
  • Concurrency interoperability with Objective-C, Swift’s predecessor language
  • Async handlers, introducing the ability to declare a synchronous actor function as an asynchronous handler

Follow Us

Join the newsletter!

Or

Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.

Tags AppleSwift

Featured

Slideshows

How MSPs can capitalise on integrating AI into existing services

How MSPs can capitalise on integrating AI into existing services

​Given the pace of change, scale of digitalisation and evolution of generative AI, partners must get ahead of the trends to capture the best use of innovative AI solutions to develop new service opportunities. For MSPs, integrating AI capabilities into existing service portfolios can unlock enhancements in key areas including managed hosting, cloud computing and data centre management. This exclusive Reseller News roundtable in association with rhipe, a Crayon company and VMware, focused on how partners can integrate generative AI solutions into existing service offerings and unlocking new revenue streams.

How MSPs can capitalise on integrating AI into existing services
Access4 holds inaugural A/NZ Annual Conference

Access4 holds inaugural A/NZ Annual Conference

​Access4 held its inaugural Annual Conference in Port Douglass, Queensland, for Australia and New Zealand from 9-11 October, hosting partners from across the region with presentations on Access4 product updates, its 2023 Partner of the Year awards and more.

Access4 holds inaugural A/NZ Annual Conference
Show Comments