Skip to content

Commit cd277a5

Browse files
authored
Record SE-110 as implemented in its current state (#1121)
Update the proposal text to describe the special case for function arguments.
1 parent 3a44151 commit cd277a5

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

proposals/0110-distingish-single-tuple-arg.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@
33
* Proposal: [SE-0110](0110-distingish-single-tuple-arg.md)
44
* Authors: Vladimir S., [Austin Zheng](https://github.com/austinzheng)
55
* Review Manager: [Chris Lattner](https://github.com/lattner)
6-
* Status: **Accepted**
6+
* Status: **Implemented**
77
* Decision Notes: [Rationale](https://lists.swift.org/pipermail/swift-evolution-announce/2016-July/000215.html), [Additional Commentary](https://lists.swift.org/pipermail/swift-evolution-announce/2017-June/000386.html)
88
* Bug: [SR-2008](https://bugs.swift.org/browse/SR-2008)
9+
* Previous Revision: [Originally Accepted Proposal](https://github.com/apple/swift-evolution/blob/9e44932452e1daead98f2bc2e58711eb489e9751/proposals/0110-distingish-single-tuple-arg.md)
910

1011
## Introduction
1112

@@ -47,10 +48,23 @@ We propose that this behavior should be fixed in the following ways:
4748

4849
We understand that this may be a departure from the current convention that a set of parentheses enclosing a single object are considered semantically meaningless, but it is the most natural way to differentiate between the two situations described above and would be a clearly-delineated one-time-only exception.
4950

51+
Existing Swift code widely takes advantage of the ability to pass a multi-parameter closure or function value to a higher-order function that operates on tuples, particularly with collection operations:
52+
53+
```
54+
zip([1, 2, 3], [3, 2, 1]).filter(<) // => [(1, 3)]
55+
zip([1, 2, 3], [3, 2, 1]).map(+) // => [4, 4, 4]
56+
```
57+
58+
Without the implicit conversion, this requires invasive changes to explicitly destructure the tuple argument. In order to gain most of the type system benefits of distinguishing single-tuple-argument functions from multiple-argument functions, while maintaining the fluidity of functional code like the above, arguments of type `(T, U, ...) -> V` in call expressions are allowed to be converted to parameters of the corresponding single-tuple parameter type `((T, U, ...)) -> V`, so the two examples above will continue to be accepted.
59+
5060
## Impact on existing code
5161

5262
Minor changes to user code may be required if this proposal is accepted.
5363

5464
## Alternatives considered
5565

5666
Don't make this change.
67+
68+
## Revision history
69+
70+
The [original proposal as reviewed](https://github.com/apple/swift-evolution/blob/9e44932452e1daead98f2bc2e58711eb489e9751/proposals/0110-distingish-single-tuple-arg.md) did not include the special-case conversion from `(T, U, ...) -> V` to `((T, U, ...)) -> V` for function arguments. In response to community feedback, [this conversion was added](https://lists.swift.org/pipermail/swift-evolution-announce/2017-June/000386.html) as part of the Core Team's acceptance of the proposal.

0 commit comments

Comments
 (0)