With Swift 6.0 and the Swift 6 language mode now released, Swift language development under the Language Steering Group is now focused on three major areas:
- making Swift Concurrency easier to approach and adopt,
- providing powerful low-level language and library tools for high-performance programming and constrained environments, and
- improving language interoperability, especially with C++ and Java.
The Swift 6 language mode provides a strong base for Swift Concurrency, but many developers are finding it difficult to adopt. The LSG is considering several ideas which we believe may significantly ease that burden. We’ve written about this at length in the prospective vision for approachable concurrency, and we're now looking for feedback on those ideas; please check it out.
Simultaneously, the LSG is interested in improving Swift’s facilities for avoiding copies and working safely with restricted values. Implementors are currently working on Span types that can be used to safely read and write contiguous arrays of objects in memory without needing to manage the memory itself. Making this memory-safe requires the use of better language support for non-copyable and non-escaping types. We are also working on features that will allow programmers to “borrow” values (read from them without copying their representation) in more situations. Taken together, this work will both make it easier to optimize the performance of Swift code and allow Swift to be safely adopted in more constrained environments, such as those envisaged by the Embedded Swift effort.
Those same language facilities are also critical for safe interoperation with C++. C++ libraries often rely on unsafe assumptions for correct usage; for example, it is common for C++ functions to return references derived from references they received as arguments, and it just has to be understood by the programmer that the return value cannot be safely used once the argument has become invalid. Swift’s support for non-copyable and non-escaping types will allow the compiler to reason about these functions and ensure that they’re used correctly, making it possible to use C++ from Swift with far greater confidence and much cleaner code.
Finally, there is an exciting new project to allow Swift to directly interoperate with Java. Historically, Swift has pursued interoperation with the C family of languages using deep integration with the Clang compiler. For Java interop, however, we are pursuing a more library-oriented solution based around reading and writing Swift interfaces. Ultimately, we hope that this project will not just allow Swift to fit cleanly into the JVM, but also enable much simpler interoperation for a broad spectrum of other languages.
We don't mean to imply that anything not on this list will not be considered; this is just a brief overview of the areas we're currently most focused on.
John McCall
Language Steering Group