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...@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").
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to