<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On May 4, 2017, at 8:14 PM, Robert Widmann via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" 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. Attached is a proposal to deprecate a language feature many of you will probably have never had the chance to use: Tuple Shuffles. I’ve attached a copy of the first draft of the proposal below, but the latest copy can be read on <a href="https://github.com/apple/swift-evolution/pull/705/files" 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></div></blockquote></div><br class=""><div class="">I'm coming into this ridiculously late. Apologies, but I've had family responsibilities. I've tried to read through the thread before replaying. I hope I have not missed any significant points.</div><div class=""><br class=""></div><div class="">First, I dislike calling this "tuple shuffles". That phrase has an existing and useful meaning in the Swift community. It refers to what this proposal calls "re-assignment through a tuple pattern". This is what I want to keep calling a "tuple shuffle":</div><div class=""><br class=""></div><div class="">`(a, b, c) = (b, c, a)`</div><div class=""><br class=""></div><div class="">I'd rather call the problem space for this proposal "label-led tuple assignment" (or something like that) and reserve "tuple shuffle" for reordered value reassignment.</div><div class=""><br class=""></div><div class="">Second, I agree with TJ. I dislike that this pattern is legal:</div><div class=""><br class=""></div><div class=""><div class="">```</div><div class="">// Declare using labels</div><div class="">let rgba: (r: Int, g: Int, b: Int, a: Int) = (255, 255, 255, 0)</div><div class=""><br class=""></div><div class="">// Declare using re-ordered labels</div><div class="">let argb: (a: Int, r: Int, g: Int, b: Int) = rgba // This is the line I have issue with</div><div class=""><br class=""></div><div class="">print(argb.a) // "0"</div></div><div class="">```</div><div class=""><br class=""></div><div class="">I find this usage counter to Swift's philosophy of clarity and simplicity. It is sufficiently obscure that I consider it a non-standard use regardless of Wux's Google search results. </div><div class=""><br class=""></div><div class="">Consider the example of Joe Groff's SE-0060 (<a href="https://github.com/apple/swift-evolution/blob/master/proposals/0060-defaulted-parameter-order.md" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0060-defaulted-parameter-order.md</a>). I believe it's reasonable to mandate that the order of labels in declarations be ignored, with the types being compiler-checked. I'd envision that the "correct" behavior should act like this instead:</div><div class=""><br class=""></div><div class="">```</div><div class=""><div class=""><div class="">// Declare using re-ordered labels</div><div class="">let argb: (a: Int, r: Int, g: Int, b: Int) = rgba // (Int, Int, Int, Int) assigned to (Int, Int, Int, Int)</div><div class=""><br class=""></div><div class="">print(argb.a) // "255"</div></div><div class="">```</div></div><div class=""><br class=""></div><div class="">This reworking is partially inspired by SE-0111 (<a href="https://github.com/apple/swift-evolution/blob/master/proposals/0111-remove-arg-label-type-significance.md" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0111-remove-arg-label-type-significance.md</a>), ensuring that the tuple argument labels are not considered in typing the new constant. In fact, this entire proposal might be better named "Removing the Ordering Significance of Tuple Argument Labels in Declarations"</div><div class=""><br class=""></div><div class="">-- E</div><div class=""><br class=""></div></body></html>