[swift-evolution] [Proposal][Discussion] Deprecate Tuple Shuffles
Xiaodi Wu
xiaodi.wu at gmail.com
Fri May 5 01:13:47 CDT 2017
On Fri, May 5, 2017 at 1:12 AM, Adrian Zubarev <
adrian.zubarev at devandartist.com> wrote:
> 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?
>
No, again, this would be banned. You are using a label (a thing that ends
in a colon) inside a tuple pattern (a thing between parenthesis that comes
after "let").
> 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/4118ef29/attachment.html>
More information about the swift-evolution
mailing list