[swift-evolution] [Proposal][Discussion] Deprecate Tuple Shuffles

Adrian Zubarev adrian.zubarev at devandartist.com
Fri May 5 01:12:43 CDT 2017

Oh pardon, on the first glance I didn’t realized the issue with that example.

Here is an updated example that would work:

let (first, second: (x, y)): (first: Int, second: (x: Int, y: Int)) = tuple
This should work right? It’s assigning the inner tuple to second while also creating two additional constants from the inner tuple. I know this is redundant and can be used as second.x, but this should work like right, because it’s nested tuple destructuring? If we’d use var instead of let then x would contain the value assigned from the inner tuple, but it would be completely independent from the new second tuple variable.

Adrian Zubarev
Sent with Airmail

Am 5. Mai 2017 um 08:04:07, Xiaodi Wu (xiaodi.wu at gmail.com) schrieb:

let (first: a, second: (x: b, y: c)): (first: Int, second: (x: Int, y: Int)) = tuple // fine, unaffected
This would be banned. You are using labels (things ending with a colon) in a pattern (the stuff that comes after the word "let").
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170505/3e8b5ec3/attachment.html>

More information about the swift-evolution mailing list