File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,33 @@ Note: This is in reverse chronological order, so newer entries are added to the
3
3
Swift 3.0
4
4
---------
5
5
6
+ * [ SE-0091] ( https://github.com/apple/swift-evolution/blob/master/proposals/0091-improving-operators-in-protocols.md ) :
7
+ Operators can now be defined within types or extensions thereof. For example:
8
+
9
+ ``` swift
10
+ struct Foo : Equatable {
11
+ let value: Int
12
+
13
+ static func == (lhs : Foo, rhs : Foo) -> Bool {
14
+ return lhs.value == rhs.value
15
+ }
16
+ }
17
+ ```
18
+
19
+ Such operators must be declared as ` static ` (or, within a class, `class
20
+ final`), and have the same signature as their global counterparts. As part of
21
+ this change, operator requirements declared in protocols must also be
22
+ explicitly declared ` static ` :
23
+
24
+ ``` swift
25
+ protocol Equatable {
26
+ static func == (lhs : Self , rhs : Self ) -> Bool
27
+ }
28
+ ```
29
+
30
+ Note that the type checker performance optimization described by SE-0091 is
31
+ not yet implemented.
32
+
6
33
* [ SE-0099] ( https://github.com/apple/swift-evolution/blob/master/proposals/0099-conditionclauses.md ) :
7
34
Condition clauses in ` if ` , ` guard ` , and ` while ` statements now use a more
8
35
regular syntax. Each pattern or optional binding must be prefixed with ` case `
You can’t perform that action at this time.
0 commit comments