<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">On the contrary, this is precisely what it means to deprecate tuple shuffles. &nbsp;You can’t map common parlance onto this term; the proposal and the Twitter thread weren’t merely about reordering arguments.</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class="">but it is entirely another ballgame to remove labels from tuple patterns altogether.</div></blockquote><br class=""></div><div class="">It’s really not. &nbsp;Let me demonstrate:</div><div class=""><br class=""></div><div class=""><blockquote type="cite" class=""><div class=""><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">To be clear, are you proposing the prohibition of *adding or removing* labels as well? A previous discussion on tuple shuffling on this list saw consensus that assigning a value of type (label1: T, label2: U) to a variable of type (T, U) and vice versa should absolutely be supported, whether or not reordering is permitted.</blockquote></div></div></blockquote><br class=""></div><div class="">I am not proposing any changes to switching parameter labels through well-typed re-assignments. &nbsp;This is absolutely still going to be allowed:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">var</span><span style="font-variant-ligatures: no-common-ligatures" class=""> z : (</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures" class="">, </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures" class="">) = (</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">0</span><span style="font-variant-ligatures: no-common-ligatures" class="">, </span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">0</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #ba2da2" class="">var</span><span style="font-variant-ligatures: no-common-ligatures" class=""> w : (x : </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures" class="">, y : </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Int</span><span style="font-variant-ligatures: no-common-ligatures" class="">) = (</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">5</span><span style="font-variant-ligatures: no-common-ligatures" class="">, </span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">10</span><span style="font-variant-ligatures: no-common-ligatures" class="">)</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">z = w</span></div><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">w = z</span></div></div></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class=""><br class=""></span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><div style="font-family: Helvetica; font-size: 12px;" class="">This is modeled internally with a tuple shuffle, but not the kind of shuffle I’m interested in banning. &nbsp;It’s a far simpler kind of&nbsp;</div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class=""><blockquote type="cite" class=""><div class=""><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;">And how about *restating* existing labels without any adding or removing? To be clear:<br class=""><br class="">```<br class="">let (partialValue: v, overflow: o) = 42.addingReportingOverflow(42)<br class="">```<br class=""><br class="">...involves absolutely no changes in labels whatsoever. The return type is (partialValue: Int, overflow: ArithmeticOverflow).<br class=""></blockquote></div></div></blockquote><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class="">That, however, is a kind of shuffle I intend to deprecate here. &nbsp;This kind of pattern is subject to the “arcane syntax” part of the proposal.</div><br class=""><blockquote type="cite" class=""><div class=""><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-style: solid; border-left-color: rgb(204, 204, 204); padding-left: 1ex;"><br class="">Either one of these scenarios is commonly used, and it is astonishing to me that they would be eliminated.</blockquote></div></div></blockquote><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class="">Do you have proof of that claim? I have never seen the relevant kinds of tuple shuffle used before, and I doubt you have either before today.</div><div style="font-family: Helvetica; font-size: 12px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 12px;" class="">~Robert Widmann</div></div><br class=""><div><blockquote type="cite" class=""><div class="">On May 5, 2017, at 12:53 AM, Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com" class="">xiaodi.wu@gmail.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">Ah, I see from your proposed grammar update: you're proposing to prohibit the use of labels entirely in a tuple pattern.</div><div class=""><br class=""></div><div class="">This is much more than just prohibiting tuple shuffling, and I'm rather disappointed that you described such a dramatic change using a corner case. There are very good reasons why someone finds 'let (y: x, x: y) = (x: 1, y: 2)' confusing and would support its removal, but it is entirely another ballgame to remove labels from tuple patterns altogether.</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><div class="gmail_quote"><div class="">On Thu, May 4, 2017 at 23:47 Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com" target="_blank" class="">xiaodi.wu@gmail.com</a>&gt; wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Now I'm confused. The ordinary meaning of the word "shuffle" is not changing but rather reordering, and all of your examples are of reordering.<br class=""><br class="">To be clear, are you proposing the prohibition of *adding or removing* labels as well? A previous discussion on tuple shuffling on this list saw consensus that assigning a value of type (label1: T, label2: U) to a variable of type (T, U) and vice versa should absolutely be supported, whether or not reordering is permitted.<br class=""><br class="">And how about *restating* existing labels without any adding or removing? To be clear:<br class=""><br class="">```<br class="">let (partialValue: v, overflow: o) = 42.addingReportingOverflow(42)<br class="">```<br class=""><br class="">...involves absolutely no changes in labels whatsoever. The return type is (partialValue: Int, overflow: ArithmeticOverflow).<br class=""><br class="">Either one of these scenarios is commonly used, and it is astonishing to me that they would be eliminated.<br class=""><br class=""><div class="gmail_quote"><div class="">On Thu, May 4, 2017 at 23:28 Robert Widmann &lt;<a href="mailto:devteam.codafi@gmail.com" target="_blank" class="">devteam.codafi@gmail.com</a>&gt; wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class=""><div class=""><div id="m_-2923833813410546814m_-383149691311174760m_1919140766618257128AppleMailSignature" class="">That doesn't involve a parameter <i class="">reordering</i>, but because it changes argument labels it's a shuffle.</div><div id="m_-2923833813410546814m_-383149691311174760m_1919140766618257128AppleMailSignature" class=""><br class=""></div>~Robert Widmann</div><div class=""><br class="">2017/05/05 0:16、Xiaodi Wu &lt;<a href="mailto:xiaodi.wu@gmail.com" target="_blank" class="">xiaodi.wu@gmail.com</a>&gt; のメッセージ:<br class=""><br class=""></div></div><div class=""><blockquote type="cite" class=""><div class=""><div class="">Robert,</div><div class=""><br class=""></div><div class="">As I mentioned on Twitter, getting rid of tuple shuffles would not cure your example, which does not involve a shuffle. Unless you're proposing to disallow the use of labels during destructuring entirely, which I would think to be very much unacceptable. Example:</div><div class=""><br class=""></div><div class="">```</div><div class="">let (partialValue: v, overflow: o) = 42.addingReportingOverflow(42)</div><div class="">```</div><div class=""><br class=""></div><div class="">This involves no shuffling and should absolutely remain allowed.</div><div class=""><br class=""></div><div class=""><br class=""><div class="gmail_quote"><div class="">On Thu, May 4, 2017 at 21:15 Robert Widmann via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class="">Hi all,<div class=""><br class=""></div><div class="">So sorry that this proposal comes so late in the game, but I feel it’s too important not to bring it to the attention of the community now.&nbsp; Attached is a proposal to deprecate a language feature many of you will probably have never had the chance to use: Tuple Shuffles.&nbsp; I’ve attached a copy of the first draft of the proposal below, but the latest copy can be read on&nbsp;<a href="https://github.com/apple/swift-evolution/pull/705/files" target="_blank" class="">Github</a>.</div><div class=""><br class=""></div><div class="">Thanks!</div><div class=""><br class=""></div><div class="">~Robert Widmann</div><div class=""><br class=""></div><div class=""><h1 style="box-sizing:border-box;margin-right:0px;margin-bottom:16px;margin-left:0px;line-height:1.25;padding-bottom:0.3em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(234,236,239);color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';background-color:rgb(255,255,255);margin-top:0px!important" class="">Deprecate Tuple Shuffles</h1><ul style="box-sizing:border-box;padding-left:2em;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px;background-color:rgb(255,255,255)" class=""><li style="box-sizing:border-box" class="">Proposal:&nbsp;<a href="https://github.com/CodaFi/swift-evolution/blob/8eaf320b3c2a117909fc0269c398e89c033a4b9f/proposals/NNNN-filename.md" style="box-sizing:border-box;background-color:transparent;color:rgb(3,102,214);text-decoration:none" target="_blank" class="">SE-NNNN</a></li><li style="box-sizing:border-box;margin-top:0.25em" class="">Authors:&nbsp;<a href="https://github.com/codafi" style="box-sizing:border-box;background-color:transparent;color:rgb(3,102,214);text-decoration:none" target="_blank" class="">Robert Widmann</a></li><li style="box-sizing:border-box;margin-top:0.25em" class="">Review Manager: TBD</li><li style="box-sizing:border-box;margin-top:0.25em" class="">Status:&nbsp;<span style="box-sizing:border-box;font-weight:600" class="">Awaiting review</span></li></ul><h2 style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(234,236,239);color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';background-color:rgb(255,255,255)" class=""><a id="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920user-content-introduction" class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920anchor" href="https://github.com/CodaFi/swift-evolution/blob/8eaf320b3c2a117909fc0269c398e89c033a4b9f/proposals/NNNN-deprecate-tuple-shuffles.md#introduction" style="box-sizing:border-box;background-color:transparent;color:rgb(3,102,214);text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"><u class=""></u><u class=""></u><u class=""></u><u class=""></u></a>Introduction</h2><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px;background-color:rgb(255,255,255)" class="">This proposal seeks the deprecation of a little-known feature of Swift called a "Tuple Shuffle".</p><h2 style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(234,236,239);color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';background-color:rgb(255,255,255)" class=""><a id="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920user-content-motivation" class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920anchor" href="https://github.com/CodaFi/swift-evolution/blob/8eaf320b3c2a117909fc0269c398e89c033a4b9f/proposals/NNNN-deprecate-tuple-shuffles.md#motivation" style="box-sizing:border-box;background-color:transparent;color:rgb(3,102,214);text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"><u class=""></u><u class=""></u><u class=""></u><u class=""></u></a>Motivation</h2><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px;background-color:rgb(255,255,255)" class="">A tuple-shuffle is an undocumented feature of Swift in which one can re-order the indices of a tuple by writing a pattern that describes a permutation in a syntax reminiscent of adding type-annotations to a parameter list:</p><div class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920highlight m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920highlight-source-swift" style="box-sizing:border-box;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px;background-color:rgb(255,255,255)"><pre style="box-sizing:border-box;font-family:SFMono-Regular,Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(246,248,250);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-break:normal" class=""><span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> a <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">=</span> (<span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">x</span>: <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">1</span>, <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">y</span>: <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">2</span>)
<span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">var</span> b<span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">:</span> (<span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">y</span>: <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">Int</span>, <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">x</span>: <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">Int</span>)
b <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">=</span> a</pre></div><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px;background-color:rgb(255,255,255)" class="">It can be used to simultaneously destructure and reorder a tuple:</p><div class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920highlight m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920highlight-source-swift" style="box-sizing:border-box;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px;background-color:rgb(255,255,255)"><pre style="box-sizing:border-box;font-family:SFMono-Regular,Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(246,248,250);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-break:normal" class=""><span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> tuple <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">=</span> (<span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">first</span>: <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">0</span>, <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">second</span>: (<span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">x</span>: <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">1</span>, <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">y</span>: <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">2</span>))
<span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> (<span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">second</span>: (<span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">x</span>: b, <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">y</span>: c), <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">first</span>: a) <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">=</span> tuple</pre></div><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px;background-color:rgb(255,255,255)" class="">It can also be used to map parameter labels out of order in a call expression:</p><div class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920highlight m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920highlight-source-swift" style="box-sizing:border-box;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px;background-color:rgb(255,255,255)"><pre style="box-sizing:border-box;font-family:SFMono-Regular,Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(246,248,250);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-break:normal" class=""><span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">func</span> <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-en" style="box-sizing:border-box;color:rgb(121,93,163)">foo</span>(<span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-smi" style="box-sizing:border-box;color:rgb(51,51,51)"><span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-en" style="box-sizing:border-box;color:rgb(121,93,163)">_</span></span> : (x : <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">Int</span>, y : <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">Int</span>)) {}
<span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">foo</span>((<span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">y</span>: <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">5</span>, <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">x</span>: <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">10</span>)) <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c" style="box-sizing:border-box">//</span> Valid</span></pre></div><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px;background-color:rgb(255,255,255)" class="">Note that a tuple shuffle is distinct from a re-assignment through a tuple pattern. For example, this series of statements will continue to function as before:</p><div class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920highlight m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920highlight-source-swift" style="box-sizing:border-box;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px;background-color:rgb(255,255,255)"><pre style="box-sizing:border-box;font-family:SFMono-Regular,Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(246,248,250);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-break:normal" class=""><span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">var</span> x <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">=</span> <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">5</span>
<span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">var</span> y <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">=</span> <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">10</span>
<span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">var</span> z <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">=</span> <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">15</span>
(z, y, x) <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">=</span> (x, z, y)</pre></div><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px;background-color:rgb(255,255,255)" class="">Their inclusion in the language complicates every part of the compiler stack, uses a&nbsp;<a href="https://twitter.com/CodaFi_/status/860246169854894081" style="box-sizing:border-box;background-color:transparent;color:rgb(3,102,214);text-decoration:none" target="_blank" class="">syntax that can be confused for type annotations</a>, contradicts the goals of earlier SE's (see&nbsp;<a href="https://github.com/apple/swift-evolution/blob/9cf2685293108ea3efcbebb7ee6a8618b83d4a90/proposals/0060-defaulted-parameter-order.md" style="box-sizing:border-box;background-color:transparent;color:rgb(3,102,214);text-decoration:none" target="_blank" class="">SE-0060</a>), and makes non-sensical patterns possible in surprising places.</p><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px;background-color:rgb(255,255,255)" class="">Take switch-statements, for example:</p><div class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920highlight m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920highlight-source-swift" style="box-sizing:border-box;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px;background-color:rgb(255,255,255)"><pre style="box-sizing:border-box;font-family:SFMono-Regular,Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(246,248,250);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-break:normal" class=""><span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">switch</span> ((<span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">0</span>, <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">0</span>), <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">0</span>){ 
<span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">case</span> (<span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">_</span> : <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> (y, z), <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c1" style="box-sizing:border-box;color:rgb(0,134,179)">_</span> : <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">let</span> s)<span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">:</span> () <span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"><span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c" style="box-sizing:border-box">//</span> We are forbidden from giving these patterns names other than "_" </span>
<span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-c" style="box-sizing:border-box;color:rgb(150,152,150)"></span><span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">default</span><span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-k" style="box-sizing:border-box;color:rgb(167,29,93)">:</span> () 
}</pre></div><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px;background-color:rgb(255,255,255)" class="">This proposal seeks to deprecate them in Swift 3 compatibility mode and enforce that deprecation as a hard error in Swift 4 to facilitate their eventual removal from the language.</p><h2 style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(234,236,239);color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';background-color:rgb(255,255,255)" class=""><a id="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920user-content-proposed-solution" class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920anchor" href="https://github.com/CodaFi/swift-evolution/blob/8eaf320b3c2a117909fc0269c398e89c033a4b9f/proposals/NNNN-deprecate-tuple-shuffles.md#proposed-solution" style="box-sizing:border-box;background-color:transparent;color:rgb(3,102,214);text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"><u class=""></u><u class=""></u><u class=""></u><u class=""></u></a>Proposed solution</h2><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px;background-color:rgb(255,255,255)" class="">Construction of Tuple Shuffle Expressions will become a warning in Swift 3 compatibility mode and will be a hard-error in Swift 4.</p><h2 style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(234,236,239);color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';background-color:rgb(255,255,255)" class=""><a id="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920user-content-detailed-design" class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920anchor" href="https://github.com/CodaFi/swift-evolution/blob/8eaf320b3c2a117909fc0269c398e89c033a4b9f/proposals/NNNN-deprecate-tuple-shuffles.md#detailed-design" style="box-sizing:border-box;background-color:transparent;color:rgb(3,102,214);text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"><u class=""></u><u class=""></u><u class=""></u><u class=""></u></a>Detailed design</h2><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px;background-color:rgb(255,255,255)" class="">In addition to the necessary diagnostics, the grammar will be ammended to simplify the following productions:</p><div class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920highlight m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920highlight-source-diff" style="box-sizing:border-box;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px;background-color:rgb(255,255,255)"><pre style="box-sizing:border-box;font-family:SFMono-Regular,Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:13.600000381469727px;margin-top:0px;margin-bottom:0px;line-height:1.45;word-wrap:normal;padding:16px;overflow:auto;background-color:rgb(246,248,250);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-break:normal" class="">tuple-pattern → (tuple-pattern-element-list &lt;opt&gt;)
tuple-pattern-element-list → tuple-pattern-element | tuple-pattern-element , tuple-pattern-element-list
<span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-md" style="box-sizing:border-box;color:rgb(189,44,0);background-color:rgb(255,236,236)"><span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-md" style="box-sizing:border-box">-</span> tuple-pattern-element → pattern | identifier:pattern</span>
<span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-mi1" style="box-sizing:border-box;color:rgb(85,165,50);background-color:rgb(234,255,234)"><span class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920pl-mi1" style="box-sizing:border-box">+</span> tuple-pattern-element → pattern</span></pre></div><h2 style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(234,236,239);color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';background-color:rgb(255,255,255)" class=""><a id="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920user-content-impact-on-existing-code" class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920anchor" href="https://github.com/CodaFi/swift-evolution/blob/8eaf320b3c2a117909fc0269c398e89c033a4b9f/proposals/NNNN-deprecate-tuple-shuffles.md#impact-on-existing-code" style="box-sizing:border-box;background-color:transparent;color:rgb(3,102,214);text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"><u class=""></u><u class=""></u><u class=""></u><u class=""></u></a>Impact on Existing Code</h2><p style="box-sizing:border-box;margin-top:0px;margin-bottom:16px;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px;background-color:rgb(255,255,255)" class="">Because very little code is intentionally using Tuple Shuffles, impact on existing code will be negligible but not non-zero.</p><h2 style="box-sizing:border-box;margin-top:24px;margin-bottom:16px;line-height:1.25;padding-bottom:0.3em;border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(234,236,239);color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';background-color:rgb(255,255,255)" class=""><a id="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920user-content-alternatives-considered" class="m_-2923833813410546814m_-383149691311174760m_1919140766618257128m_5304457839982547920anchor" href="https://github.com/CodaFi/swift-evolution/blob/8eaf320b3c2a117909fc0269c398e89c033a4b9f/proposals/NNNN-deprecate-tuple-shuffles.md#alternatives-considered" style="box-sizing:border-box;background-color:transparent;color:rgb(3,102,214);text-decoration:none;float:left;padding-right:4px;line-height:1" target="_blank"><u class=""></u><u class=""></u><u class=""></u><u class=""></u></a>Alternatives considered</h2><div style="box-sizing:border-box;margin-top:0px;color:rgb(36,41,46);font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px;background-color:rgb(255,255,255);margin-bottom:0px!important" class="">Continue to keep the architecture in place to facilitate this feature.</div></div></div>_______________________________________________<br class="">
swift-evolution mailing list<br class="">
<a href="mailto:swift-evolution@swift.org" target="_blank" class="">swift-evolution@swift.org</a><br class="">
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class="">
</blockquote></div></div>
</div></blockquote></div></blockquote></div></blockquote></div></div>
</div></blockquote></div><br class=""></body></html>