Just to double check, here is the updated version of my code snippet on how it would look like if this proposal will be accepted.
let a: (x: Int, y: Int) = (1, 2) var b: (y: Int, x: Int) = a Label swap while destructuring: let tuple: (first: Int, second: (x: Int, y: Int)) = (0, (1, 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 // will the rendering be banned or not? Is this correct now? -- Adrian Zubarev Sent with Airmail Am 5. Mai 2017 um 07:53:51, Xiaodi Wu (xiaodi...@gmail.com) schrieb: On Fri, May 5, 2017 at 12:52 AM, Adrian Zubarev <adrian.zuba...@devandartist.com> wrote: Eliminating all labels would mean that even the first example from my last post will be banned. No, not eliminating all labels from tuples, but from tuple _patterns_. Is there any difference from labels in tuple types and labels in tuples themselves? Personally I would not support the removal of labels from tuple types, because it’s a very useful feature that replaces indexed access like myTuple.1 to a more readable counterpart myTuple.somethingSpecial. Am I still missing something out? -- Adrian Zubarev Sent with Airmail Am 5. Mai 2017 um 07:43:49, Xiaodi Wu (xiaodi...@gmail.com) schrieb: On Fri, May 5, 2017 at 12:42 AM, Adrian Zubarev via swift-evolution <swift-evolution@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 banned.
_______________________________________________ swift-evolution mailing list swift-evolution@swift.org https://lists.swift.org/mailman/listinfo/swift-evolution