[swift-evolution] [Proposal][Discussion] Deprecate Tuple Shuffles
xiaodi.wu at gmail.com
Fri May 5 00:43:27 CDT 2017
On Fri, May 5, 2017 at 12:42 AM, Adrian Zubarev via swift-evolution <
swift-evolution at swift.org> wrote:
> Okay now I see where this is going. So basically you want to mirror the
> behavior of function parameters into tuples.
> You might want to be a little bit more explicit on types in your proposal
> to better understand the so called ‘tuple shuffle’.
> let a: (x: Int, y: Int) = (x: 1, y: 2)
> var b: (y: Int, x: Int) = a
> a.x == b.x
> a.y == b.y
> Label swap (tuple shuffle) while destructuring:
> let tuple: (first: Int, second: (x: Int, y: Int)) = (first: 0, second: (x: 1, y: 2))
> let (first: a, second: (x: b, y: c)): (first: Int, second: (x: Int, y: Int)) = tuple // fine, unaffected
> let (second: (x: b, y: c), first: a): (second: (x: Int, y: Int), first: Int) = tuple // shuffle => error
No, I thought this was what Robert was proposing, but he is proposing the
elimination of all labels in tuple patterns. Your second example would be
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution