Apple has released Swift 5.10, an update to the company’s open-source programming language that reaches a major milestone: providing safety against data races via full data isolation in the concurrency model. The improvement prepares the way for the planned Swift 6 release.
Binaries for Swift 5.10, introduced March 5, can be found at swift.org for Windows, macOS, and Linux.
In explaining the milestone, Apple Swift engineer Holly Borla said an increasingly important source of undefined behavior is concurrent code that inadvertently accesses memory from one thread at the same time that another thread is writing to the same memory. This unsafety is called a data race, which makes concurrent programs exceptionally difficult to write, Borla noted. Swift 5.10 finally accomplishes full data isolation for concurrency after years of active development. The concurrency model was introduced in Swift 5.5 in September 2021.
Swift 5.10 enforces full data isolation at compile time when the complete concurrency checking option is enabled, Borla said. This sets the stage for Swift 6, which will offer an opt-in Swift 6 language mode that enforces full data isolation by default. In the meantime, Swift 5.10 will produce data-race warnings in some circumstances where code could be proven safe with additional compiler analysis.
A key focus of language development for Swift 6 is improving the usability of strict concurrency checking by mitigating false positive concurrency errors in common patterns proven to be safe, Borla said. Structured concurrency has been cited as a server-side goal for the Swift language.
Copyright © 2024 IDG Communications, Inc.