Skip to content

Commit 7cd7f26

Browse files
daveverweralexandersandbergtimsneath
authored
Ready for Swift 6 blog post (#734)
* First draft of Ready for Swift 6 blog post. * Minor tweaks. * I don’t think these are doing anything! * Typo fix. Co-authored-by: Alexander Sandberg <[email protected]> * Typo fix. Co-authored-by: Alexander Sandberg <[email protected]> * Typo fix. Co-authored-by: Alexander Sandberg <[email protected]> * Removed duplicate point. * Corrected two grammatical errors. * Tweaks. Co-authored-by: Tim Sneath <[email protected]> * Tweaks. Co-authored-by: Tim Sneath <[email protected]> * Link to the data race safety section of the Swift 6 migration guide. * Added one more link to the migration guide. * Tweak. * Tweaks. Co-authored-by: Tim Sneath <[email protected]> * Tweaked the complete concurrency link. * Sendable to code voice. * Added a sentence explaining why data race errors are bad. * Clarified the purpose of the matrix. * Final tweak. * Updated date. * Final tweaks. --------- Co-authored-by: Alexander Sandberg <[email protected]> Co-authored-by: Tim Sneath <[email protected]>
1 parent 6b4e211 commit 7cd7f26

File tree

4 files changed

+39
-0
lines changed

4 files changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
layout: post
3+
published: true
4+
date: 2024-06-28 12:00:00
5+
title: Plotting a Path to a Package Ecosystem without Data Race Errors
6+
author: [daveverwer, svenaschmidt]
7+
---
8+
9+
Swift 6 introduces [compile-time data race safety checking](https://www.swift.org/migration/documentation/swift-6-concurrency-migration-guide/dataracesafety) for any code that [opts in to use the Swift 6 language mode](https://www.swift.org/migration/documentation/swift-6-concurrency-migration-guide/swift6mode). While individual modules can adopt this mode incrementally and independently of their dependencies, the full benefit of runtime data race safety is only realized when all modules have opted in. Therefore, the quick adoption of Swift 6 language mode across the ecosystem of open-source packages will play a key role in advancing data race safety across the entire Swift ecosystem.
10+
11+
Data races can lead to crashes, inconsistent behaviour, and performance issues in apps so the sooner apps and their dependencies can adopt the Swift 6 language mode and opt in to these checks, the better!
12+
13+
## Tracking Swift 6 Readiness and Progress
14+
15+
The Swift Package Index’s new [Ready for Swift 6](https://swiftpackageindex.com/ready-for-swift-6) page tracks progress toward data race safety across the entire package ecosystem. While packages can opt in to Swift 6 language mode at their convenience, this page shows the number of packages that would pass those checks if all strict concurrency checks were enabled for all packages.
16+
17+
The Swift Package Index has been running these checks using Swift 6 nightly toolchains since early May, and there has already been a steady reduction in the [number of packages with data race errors](https://swiftpackageindex.com/ready-for-swift-6#total-zero-errors). For the past week, the Swift Package Index build machines have been running fresh builds with the advantage of platform SDKs with more `Sendable` conformance, bringing the total percentage of packages with zero data race errors to over 43%! That's a really great start for being only one week into the Swift 6 beta process.
18+
19+
![Chart showing the number of packages with no data race errors increasing over time from May this year](/assets/images/ready-for-swift-6-blog/packages-with-no-data-race-errors.png)
20+
21+
Over time, successful adoption of Swift 6 language mode in the package ecosystem will come from two directions. First, as more packages opt into these checks, package authors will fix potential data races highlighted by the compiler, increasing compatibility and reducing errors. Second, compiler iterations will refine data race checking and consolidate error diagnostics.
22+
23+
## Data Race Safety Indicators
24+
25+
When evaluating a package, it is helpful to know if that package has any reported data race safety issues. To assist with this, the Swift Package Index now displays a “Safe from data races” label alongside other package metadata when packages compile with zero errors [using `complete` strict concurrency checks](https://www.swift.org/migration/documentation/swift-6-concurrency-migration-guide/completechecking).
26+
27+
![Package metadata shown on the Swift Package Index showing that the package has no data race errors](/assets/images/ready-for-swift-6-blog/package-showing-safe-from-data-races.png)
28+
29+
### Compatibility vs Data Race Safety
30+
31+
During the transition to Swift 6, you will likely see packages that show a green checkmark against Swift 6 in Swift Package Index’s platform and Swift version compatibility matrix while also showing that the package has data race safety errors:
32+
33+
![A Swift Package Index compatibility matrix showing a green checkmark against Swift 6 compatibility](/assets/images/ready-for-swift-6-blog/package-compatibility-with-swift-6.png)
34+
35+
When compiling packages to check compatibility with Swift 6, the Swift Package Index uses whichever language mode the package author specifies. A package can be compatible with Swift 6 before it adopts the Swift 6 language mode and strict concurrency checks and the matrix only ever shows compatibility. Whether you adopt a package with potential data race safety issues is yours to make, but if the compatibility matrix shows a green checkmark, you can.
36+
37+
## Call to Action: Adopt the Swift 6 Language Mode
38+
39+
Compile-time data race safety is a major advance for the Swift language, eliminating an entire class of potential concurrency bugs and elevating your code's safety and maintainability. Every module that migrates to Swift 6 contributes to the community-wide transition to bring data race safety to the Swift software ecosystem. You can help by [updating your own packages](https://www.swift.org/migration/), and you can follow the broader ecosystem's progress on the [Ready for Swift 6 page on the Swift Package Index](https://swiftpackageindex.com/ready-for-swift-6).
23.3 KB
Loading
101 KB
Loading
47.9 KB
Loading

0 commit comments

Comments
 (0)