For how long will the Swift 5 language mode receive new Swift language features?

I've seen a lot of topics about Swift concurrency where folks suggest that you don't need to adopt Swift 6 yet because the Swift 5 & 4 modes both still exist, despite Swift 4 being released 7 years ago, and can interoperate with 6. And, perhaps more importantly, that non-breaking new features in Swift work in the Swift 5 language mode.

This is very welcome, because my employer has several million lines of Swift code in production. Fully adopting Swift 6, given our use of libraries like RxSwift which haven't been updated and have complex interactions with concurrency (their own scheduling system, for example), is likely to be a huge task.

Hence my question: is there an official policy describing when features will be supported in Swift 5 mode and when they're allowed to skip it? And if so, for how long does that policy hold?

In the quite likely and understandable event that there is no such policy, I'm curious how the language mode check is done in the compiler, so we can make our own assessment of whether it's likely that implementors of new features will find it hard to continue to support Swift 5 mode. Are there any notable features in 5 that aren't in 4? Does strict checking enable any new optimizations that can't be backported to 5?

2 Likes

The goal of language modes is that they only guard the source-breaking aspects of proposals. For instance, the additive portions of typed throws were not put behind a language mode, and only the source-breaking changes to inference rules was held back until a future language mode. It's possible that not every language mode check is triggered at the most narrow possible location, but broad strokes I think the policy of 'only guard the source breaking parts' has been followed pretty closely.

6 Likes