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
2626Swift Next
2727----------
2828
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+
2952* [ SR-4206] [ ] :
3053
3154 A method override is no longer allowed to have a generic signature with
@@ -7711,6 +7734,7 @@ Swift 1.0
77117734[SE- 0244 ]: < https: // github.com/apple/swift-evolution/blob/master/proposals/0244-opaque-result-types.md>
77127735[SE- 0245 ]: < https: // github.com/apple/swift-evolution/blob/master/proposals/0245-array-uninitialized-initializer.md>
77137736[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>
77147738[SE- 0254 ]: < https: // github.com/apple/swift-evolution/blob/master/proposals/0254-static-subscripts.md>
77157739
77167740[SR- 106 ]: < https: // bugs.swift.org/browse/SR-106>
You can’t perform that action at this time.
0 commit comments