• Thu. Sep 19th, 2024

Swift 6 arrives with improved concurrency, data-race safety

Byadmin

Sep 18, 2024



Swift 6, the latest version of the general-purpose language developed by Apple, is now available. The language update features concurrency improvements, including extended safety guarantees for data races. Linux and Windows support and a new testing library are also featured.

Published September 16, the update can be downloaded from Swift.org. For the language and standard library, a new opt-in language mode extends safety guarantees by diagnosing potential data races in code as compiler errors. Data-race safety checks previously were available as warnings in Swift 5.10, introduced March 5. Additionally, there are fewer false positives on Swift warnings due to an improved Sendable inference and new compiler analysis for transferring mutable state from one actor to another. Version 6 also includes a synchronization library for low-level concurrency APIs, including atomic operations and a mutex API. These and other updates in Swift 6 mark the start of a journey to make data-race safety dramatically easier, according to the announcement posted on September 17.

For Linux and Windows, Swift 6 unifies the implementation of Foundation, for accessing data types, collections, and operating systems, across all platforms. MacOS and iOS have used the Swift implementation of Foundation since Swift 5.9, introduced last year. Swift 6 brings these improvements to Windows and Linux. For Linux, Swift 6 offers official testing and support for Debian and Fedora, along with Ubuntu 24.04. Fully statically linked executables are also offered for Linux. And, for Windows, pre-built toolchains are available for the arm64 architecture, bringing improved compiler performance for Windows on Arm hosts. Also in Swift 6, the package manager parallelizes builds across multiple cores on Windows by default, which can improve performance on a 10-core machine by as much as 10 times, according to the announcement.



Source link