<div dir="ltr">On Fri, May 5, 2017 at 2:04 AM, Adrian Zubarev <span dir="ltr"><<a href="mailto:adrian.zubarev@devandartist.com" target="_blank">adrian.zubarev@devandartist.com</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div class="m_-5961184854423040877bloop_markdown"><p>Personally I don’t see the latter as an issue, at least not in that particular example of yours, because you can always look up the type of your labeled tuple.</p></div></div></blockquote><div>That's an argument that can be made for nearly all labels in the language, is it not? Function argument labels could be entirely removed, by your argument, since parameter names are completely visible in the documentation and you can always just look it up. Consider the rationale behind revising SE-0111 expressly to allow "cosmetic" labels. As I said, many languages don't have labels, but Swift does.</div><div><br></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"><div class="m_-5961184854423040877bloop_markdown">
<hr>
<p>Is there any benefit gained from labels in tuple destructuring? <code>let (x: x, y: y)</code> is redundant to my eyes. If we ban reordering now, than I don’t see choosing different names in tuple destructuring as a strong argument of allowing labels there <code>let (x: a, y: b)</code>. They’re literally the same as one would write comments inside the destructured tuple <code>let (/* my x */ x, /* my y*/ y)</code>.</p></div></div></blockquote><div>If you look in the C++ parts of the Swift compiler, that's the style for arguments in function calls where in Swift we use argument labels. Same idea. Your argument would remove most if not all labels from the language.</div><div><br></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"><div class="m_-5961184854423040877bloop_markdown">
<p></p></div><div class="m_-5961184854423040877bloop_original_html"><span class=""><div id="m_-5961184854423040877bloop_customfont" style="font-family:Helvetica,Arial;font-size:13px;color:rgba(0,0,0,1.0);margin:0px;line-height:auto"><br></div> <br> <div id="m_-5961184854423040877bloop_sign_1493967085779695872" class="m_-5961184854423040877bloop_sign"><div style="font-family:helvetica,arial;font-size:13px">-- <br>Adrian Zubarev<br>Sent with Airmail</div></div> <br></span><span class=""><p class="m_-5961184854423040877airmail_on">Am 5. Mai 2017 um 08:36:20, Xiaodi Wu via swift-evolution (<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>) schrieb:</p> <blockquote type="cite" class="m_-5961184854423040877clean_bq"><span><div><div style="color:rgb(0,0,0);font-family:helvetica;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">```</div><div style="color:rgb(0,0,0);font-family:helvetica;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">let tuple = (x: 1, y: 2)</div><div style="color:rgb(0,0,0);font-family:helvetica;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="color:rgb(0,0,0);font-family:helvetica;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">// I, silly human, mistakenly think the elements in the tuple are</div><div style="color:rgb(0,0,0);font-family:helvetica;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">// `y` first, then `x`. I'm a confused human. Now I write:</div><div style="color:rgb(0,0,0);font-family:helvetica;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="color:rgb(0,0,0);font-family:helvetica;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">let (y: y, x: x) = tuple<br></div><div style="color:rgb(0,0,0);font-family:helvetica;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">// Currently, does the right thing, even though I'm confused.</div><div style="color:rgb(0,0,0);font-family:helvetica;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="color:rgb(0,0,0);font-family:helvetica;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">let (y: y, x: x) = tuple</div><div style="color:rgb(0,0,0);font-family:helvetica;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">// Without tuple reordering, this produces an error, which corrects my confusion.</div><div style="color:rgb(0,0,0);font-family:helvetica;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="color:rgb(0,0,0);font-family:helvetica;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div>let (y, x) = tuple</div><div>// Oops. I'm out of luck.</div></div><div style="color:rgb(0,0,0);font-family:helvetica;font-size:13px;font-style:normal;font-variant-caps:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">```</div></div></span></blockquote></span></div><div class="m_-5961184854423040877bloop_markdown"><p></p></div></div></blockquote></div><br></div></div>