Skip to content

Commit 2c10ffe

Browse files
authored
Merge pull request #2539 from dempseyatgithub/0441-update-to-deprecate-not-obsolete
Accept SE-0441 and revise to reflect changes in accepted proposal
2 parents b3d79af + 540b9c6 commit 2c10ffe

File tree

1 file changed

+11
-23
lines changed

1 file changed

+11
-23
lines changed

proposals/0441-formalize-language-mode-terminology.md

Lines changed: 11 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
* Proposal: [SE-0441](0441-formalize-language-mode-terminology.md)
44
* Author: [James Dempsey](https://github.com/dempseyatgithub)
55
* Review Manager: [John McCall](https://github.com/rjmccall)
6-
* Status: **Active review (July 15th...29th, 2024)**
7-
* Implementation: [apple/swift-package-manager#7620](https://github.com/apple/swift-package-manager/pull/7620)
8-
* Review: ([first pitch](https://forums.swift.org/t/pitch-formalize-swift-language-mode-naming-in-tools-and-api/71733)) ([second pitch](https://forums.swift.org/t/pitch-2-formalize-language-mode-naming-in-tools-and-api/72136)) ([review](https://forums.swift.org/t/se-0441-formalize-language-mode-terminology/73182))
6+
* Status: **Accepted**
7+
* Implementation: [swiftlang/swift-package-manager#7620](https://github.com/swiftlang/swift-package-manager/pull/7620), [swiftlang/swift#75564](https://github.com/swiftlang/swift/pull/75564)
8+
* Review: ([first pitch](https://forums.swift.org/t/pitch-formalize-swift-language-mode-naming-in-tools-and-api/71733)) ([second pitch](https://forums.swift.org/t/pitch-2-formalize-language-mode-naming-in-tools-and-api/72136)) ([review](https://forums.swift.org/t/se-0441-formalize-language-mode-terminology/73182)) ([acceptance](https://forums.swift.org/t/accepted-se-0441-formalize-language-mode-terminology/73716))
99

1010
## Introduction
1111
The term "Swift version” can refer to either the toolchain/compiler version or the language mode. This ambiguity is a consistent source of confusion. This proposal formalizes the term _language mode_ in tool options and APIs.
1212

1313
## Proposed Solution
14-
The proposed solution is to use the term _language mode_ for the appropriate Swift compiler option and Swift Package Manager APIs. Use of "Swift version" to refer to language mode will be deprecated or obsoleted as needed.
14+
The proposed solution is to use the term _language mode_ for the appropriate Swift compiler option and Swift Package Manager APIs. Use of "Swift version" to refer to language mode will be deprecated.
1515

1616
### Terminology
1717
The term _language mode_ has been consistently used to describe this compiler feature since it was introduced with Swift 4.0 and is an established term of art in the Swift community.
@@ -49,7 +49,7 @@ Add a new `init` method to `Package` with the following changes from the current
4949
- The parameter `swiftLanguageVersions` is renamed to `swiftLanguageModes`
5050
- The parameter type is now an optional array of `SwiftLanguageMode` values instead of `SwiftVersion` values
5151

52-
The existing init method will be marked as `obsoleted` and `renamed` allowing the compiler to provide a fix-it.
52+
The existing init method will be marked as `deprecated` and `renamed` allowing the compiler to provide a fix-it.
5353

5454
#### 2. Rename `swiftLanguageVersions` property to `swiftLanguageModes`
5555
Rename the public `Package` property `swiftLanguageVersions` to `swiftLanguageModes`. Add a `swiftLanguageVersions` computed property that accesses `swiftLanguageModes` for backwards compatibility.
@@ -104,7 +104,7 @@ The `-swift-version` option will be suppressed from the top-level help of the co
104104
### Swift Package Manager
105105
Proposed Swift Package Manager API changes are limited to manifests \>= 6.0:
106106

107-
### New Package init method and obsoleted init method
107+
### New Package init method and deprecated init method
108108
A new `init` method will be added to `Package` that renames the `swiftLanguageVersions` parameter to `swiftLanguageModes` with the type of the parameter being an optional array of `SwiftLanguageMode` values instead of `SwiftVersion` values:
109109

110110
```swift
@@ -123,10 +123,11 @@ Package(
123123
```
124124

125125

126-
The existing init method will be marked as `obsoleted` and `renamed`, allowing the compiler to provide a fix-it:
126+
The existing init method will be marked as `deprecated` and `renamed`, allowing the compiler to provide a fix-it:
127127

128128
```
129-
@available(_PackageDescription, introduced: 5.3, obsoleted: 6, renamed:
129+
@_disfavoredOverload
130+
@available(_PackageDescription, introduced: 5.3, deprecated: 6, renamed:
130131
"init(name:defaultLocalization:platforms:pkgConfig:providers:products:
131132
dependencies:targets:swiftLanguageModes:cLanguageStandard:
132133
cxxLanguageStandard:)")
@@ -139,19 +140,6 @@ cxxLanguageStandard:)")
139140
) {
140141
```
141142
142-
#### Obsoleting existing init method
143-
The existing method must be obsoleted because the two methods are ambiguous when the default value for `swiftLanguageVersions` / `swiftLanguageModes` is used:
144-
145-
```
146-
Package ( // Error: Ambiguous use of 'init'
147-
name: "MyPackage",
148-
products: ...,
149-
targets: ...
150-
)
151-
```
152-
153-
This follows the same approach used by all past revisions of the Package `init` method.
154-
155143
See the **Source compatibility** section for more details about this change.
156144
157145
### Rename `swiftLanguageVersions` property to `swiftLanguageModes`
@@ -212,11 +200,11 @@ public struct SwiftSetting {
212200
```
213201
214202
## Source compatibility
215-
The new Package `init` method and obsoleting of the existing `init` method will cause source breakage for package manifests that specify the existing `swiftLanguageVersions` parameter when updating to swift tools version 6.0
203+
The new Package `init` method and deprecating the existing `init` method will cause a deprecation warning for package manifests that specify the existing `swiftLanguageVersions` parameter when updating to swift tools version 6.0
216204
217205
A search of manifest files in public repositories suggests that about 10% of manifest files will encounter this breakage.
218206
219-
Because the obsoleted `init` method is annotated as `renamed` the compiler will automatically provide a fix-it to update to the new `init` method.
207+
Because the deprecated `init` method is annotated as `renamed` the compiler will automatically provide a fix-it to update to the new `init` method.
220208
221209
Renaming the public `swiftLanguageVersions` property of `Package` preserves backwards compatibility by introducing a computed property with that name. The computed property will be marked as `deprecated` in 6.0 and annotated as `renamed` to provide a fix-it.
222210

0 commit comments

Comments
 (0)