Apple lays out plans for Swift 4.0
Fresh from releasing version 3.0 of its Swift language, Apple is elaborating further on plans for Swift 4.0, which is expected late next year.
The upgrade will range from resilience to memory ownership model to strings, with particular focus on source stability for code and ABI stability for the standard library, according to documentation in GitHub.
To that end, Apple is dividing the Swift 4 release into two stages. The first stage, involving source and ABI stability, will consider features that do not fundamentally change the ABI of existing features in the language or imply an ABI-breaking alteration to the standard library.
High-priority features backing stage 1 goals include accommodations to support code bases targeting different language versions, so Swift can deliver on source compatibility goals while progress continues. Also for stage 1, Apple is looking for resilience, specifically to enable APIs to evolve while maintaining a stable ABI. Resilience, for example, would eliminate the fragile base class problem that occurs in some object-oriented languages by describing types of API changes that can be made without breaking the ABI.
Apple also touched on generics improvements needed in the standard library. The library has a number of workarounds for language deficiencies, and “if the underlying language deficiencies remain, they become a permanent part of the stable ABI,” the documentation states. “Conditional conformances, recursive protocol requirements, and where clauses for associated types are known to be in this category, but it’s plausible that other features will be in scope if they would be used in the standard library.”
System programmers are seeking an opt-in Cyclone/Rust-inspired model for memory ownership models in high-performance applications. “This feature will fundamentally shape the ABI, from low-level language concerns such as ‘inout’ and low-level ‘addressors’ to its impact on the standard library,” according to the GitHub documentation. “While a full memory ownership model is likely too large for Swift 4 stage 1, we need a comprehensive design to understand how it will change the ABI.”
Apple says it needs to improve code generation, including interaction with the language’s runtime, to stabilize the ABI. “While not specifically user-facing, the decisions here affect performance and (in some rare cases) the future evolution of Swift.” The upgrade also seeks to make strings more powerful and easier to use while retaining correctness with Unicode.
The second stage of Swift 4.0’s development, anticipated next spring, begins when implementation of stage 1 features is “cresting” and contains other large and small features.