You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: commonly_proposed.md
+8Lines changed: 8 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -24,10 +24,18 @@ Several of the discussions below refer to "C Family" languages. This is intende
24
24
25
25
*[Rename `guard` to `unless`](https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160104/005534.html): It is a common request to ask that `guard` be renamed `unless`. People requesting this change argue that `guard` is simply a logically-inverted `if` statement, and therefore `unless` is a more obvious keyword. However, such requests stem from a fundamental misunderstanding of the functionality provided by `guard`. Unlike `if`, `guard`*enforces* that the code within its curly braces provides an early exit from the codepath. In other words, a `guard` block **must**`return`, `throw`, `break`, `continue` or call a `@noreturn` function such as `fatalError()`. This differs from `if` quite significantly, and therefore the parallels assumed between `guard` and `if` are not valid.
26
26
27
+
*[Use Garbage Collection instead of ARC](https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160208/009403.html): Mark and sweep garbage collection is a well known technique used in many popular and widely used languages (e.g. Java and Javascript) and it has the advantage of automatically collecting reference cycles that ARC requires the programmer to reason about. That said, garbage collection has a [large number of disadvantages](https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20160208/009422.html) and using it would prevent Swift from successfully targeting a number of systems programming domains. For example, real time systems (video or audio processing), deeply embedded controllers, and most kernels find GC to be generally unsuitable. Further, GC is only efficient when given 3-4x more memory to work with than the process is using at any time, and this tradeoff is not acceptable for Swift.
28
+
27
29
Here are some other less-commonly proposed changes that have also been rejected:
28
30
29
31
*[Remove `;` Semicolons](https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20151214/002421.html): Semicolons within a line are an intentional expressivity feature. Semicolons at the end of the line should be handled by a "linter", not by the compiler.
30
32
31
33
*[Remove support for `default:` in Switch, and just use `case _:`](https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20151207/001422.html): `default` is widely used, `case _` is too magical, and default is widely precedented in many C family languages.
32
34
33
35
*[SE-0009: Require self for accessing instance members ](proposals/0009-require-self-for-accessing-instance-members.md)
36
+
37
+
*[SE-0024: Optional Value Setter `??=`](proposals/0024-optional-value-setter.md)
38
+
39
+
*[SE-0027: Expose code unit initializers on String](proposals/0027-string-from-code-units.md)
5.**Prepend "is" to Boolean properties**: [Boolean properties should read as assertions on the receiver](https://swift.org/documentation/api-design-guidelines.html#boolean-assertions), but the Objective-C Coding Guidelines for Cocoa [prohibit the use of "is" on properties](https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/CodingGuidelines/Articles/NamingIvarsAndTypes.html#//apple_ref/doc/uid/20001284-BAJGIIJE). Import such properties with "is" prepended.
109
109
110
-
6.**Strip the "NS" prefix from Foundation APIs**: Foundation is a
111
-
fundamental part of the [Swift Core Libraries][core-libraries], and
112
-
having the prefixes on these cross-platform APIs feels
113
-
anachronistic. Therefore, remove the "NS" prefix from entities defined
114
-
in the Foundation module (and other specifically identified modules where it makes sense).
110
+
6.**Lowercase values**: The Swift API Design Guidelines have non-type
111
+
declarations lowercased. Lowercase non-prefixed values whenever they
112
+
are imported, including enumerators (whether they end up in Swift as
113
+
enum cases or option sets) and any other properties/functions (e.g., a
114
+
property named `URLHandler` will be lowercased to `urlHandler`).
115
115
116
116
7.**Adopt Comparable to classes that implement**`compare(_:) -> NSComparisonResult`: The objective-c classes that implement compare all have declared a capability of being compared in an ordered manner. `Comparable` formalizes this declaration into an implementable operator by the import process.
117
117
@@ -137,21 +137,21 @@ the imported `UIBezierPath` API in Swift 2:
137
137
138
138
And the same API imported under our current, experimental implementation of this proposal:
0 commit comments