File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -26,6 +26,29 @@ CHANGELOG
26
26
Swift Next
27
27
----------
28
28
29
+ * [ SE-0253] [ ] :
30
+
31
+ Values of types that declare ` func callAsFunction ` methods can be called
32
+ like functions. The call syntax is shorthand for applying
33
+ ` func callAsFunction ` methods.
34
+
35
+ ``` swift
36
+ struct Adder {
37
+ var base: Int
38
+ func callAsFunction (_ x : Int ) -> Int {
39
+ return x + base
40
+ }
41
+ }
42
+ var adder = Adder (base : 3 )
43
+ adder (10 ) // returns 13, same as `adder.callAsFunction(10)`
44
+ ```
45
+
46
+ * ` func callAsFunction ` argument labels are required at call sites.
47
+ * Multiple ` func callAsFunction ` methods on a single type are supported.
48
+ * ` mutating func callAsFunction ` is supported.
49
+ * ` func callAsFunction ` works with ` throws ` and ` rethrows ` .
50
+ * ` func callAsFunction ` works with trailing closures.
51
+
29
52
* [ SR-4206] [ ] :
30
53
31
54
A method override is no longer allowed to have a generic signature with
@@ -7711,6 +7734,7 @@ Swift 1.0
7711
7734
[SE- 0244 ]: < https: // github.com/apple/swift-evolution/blob/master/proposals/0244-opaque-result-types.md>
7712
7735
[SE- 0245 ]: < https: // github.com/apple/swift-evolution/blob/master/proposals/0245-array-uninitialized-initializer.md>
7713
7736
[SE- 0252 ]: < https: // github.com/apple/swift-evolution/blob/master/proposals/0252-keypath-dynamic-member-lookup.md>
7737
+ [SE- 0253 ]: < https: // github.com/apple/swift-evolution/blob/master/proposals/0253-callable.md>
7714
7738
[SE- 0254 ]: < https: // github.com/apple/swift-evolution/blob/master/proposals/0254-static-subscripts.md>
7715
7739
7716
7740
[SR- 106 ]: < https: // bugs.swift.org/browse/SR-106>
You can’t perform that action at this time.
0 commit comments