<div dir="ltr">On Wed, Jun 7, 2017 at 10:15 PM, Susan Cheng via swift-evolution <span dir="ltr">&lt;<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>&gt;</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 dir="ltr">Just a thought<div><br></div><div>if parentheses is important, why the tuples are not?</div></div></blockquote><div><br></div><div>It is not parentheses that are important; it is the distinction between an argument list and a tuple. They both happen to be written with parentheses.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="color:rgb(186,45,162)">var</span> tuple1: (<span style="color:rgb(112,61,170)">Int</span>, <span style="color:rgb(112,61,170)">Int</span>) = (<span style="color:rgb(39,42,216)">0</span>, <span style="color:rgb(39,42,216)">0</span>)</p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="color:rgb(186,45,162)">var</span> tuple2: ((((<span style="color:rgb(112,61,170)">Int</span>, <span style="color:rgb(112,61,170)">Int</span>)))) = (<span style="color:rgb(39,42,216)">0</span>, <span style="color:rgb(39,42,216)">0</span>)</p>
<p style="margin:0px;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px"><br></p>
<p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">type(of: <span style="color:rgb(79,129,135)">tuple1</span>) == type(of: <span style="color:rgb(79,129,135)">tuple2</span>)    <span style="color:rgb(0,132,0)">// true</span></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><br></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="color:rgb(186,45,162)">var</span> void: ((((((())))))) = ()</p><p style="margin:0px;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px"><br></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">


</p><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">type(of: <span style="color:rgb(79,129,135)">void</span>) == type(of: Void())  <span style="color:rgb(0,132,0)">// true</span></p></div><div><span style="color:rgb(0,132,0)"><br></span></div></div><div class="gmail_extra"><br><div class="gmail_quote"><span class="">2017-06-07 10:15 GMT+08:00 Susan Cheng <span dir="ltr">&lt;<a href="mailto:susan.doggie@gmail.com" target="_blank">susan.doggie@gmail.com</a>&gt;</span>:<br></span><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><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,&#39;Segoe UI&#39;,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;">Introduction</h2></div><div><br></div>Because the painful of SE-0110, here is a proposal to clarify the tuple syntax.<br><div><br></div><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,&#39;Segoe UI&#39;,Helvetica,Arial,sans-serif,&#39;Apple Color Emoji&#39;,&#39;Segoe UI Emoji&#39;,&#39;Segoe UI Symbol&#39;">Proposed solution</h2></div><div>1. single element tuple always be flattened</div><div><br></div><div><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)"><span style="color:rgb(186,45,162)">let</span><span style="color:rgb(0,0,0)"> tuple1: (((</span><span style="color:rgb(112,61,170)">Int</span><span style="color:rgb(0,0,0)">))) = </span><span style="color:rgb(39,42,216)">0</span><span style="color:rgb(0,0,0)">  </span>// TypeOf(tuple1) == Int</p><p style="margin:0px;font-size:12px;line-height:normal;font-family:Helvetica;min-height:14px"><br></p><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">

</p><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,132,0)"><span style="color:rgb(186,45,162)">let</span><span style="color:rgb(0,0,0)"> tuple2: ((((</span><span style="color:rgb(112,61,170)">Int</span><span style="color:rgb(0,0,0)">))), </span><span style="color:rgb(112,61,170)">Int</span><span style="color:rgb(0,0,0)">) = (</span><span style="color:rgb(39,42,216)">0</span><span style="color:rgb(0,0,0)">, </span><span style="color:rgb(39,42,216)">0</span><span style="color:rgb(0,0,0)">)  </span>// TypeOf(tuple2) == (Int, Int)</p></div><div><br></div><div>2. function arguments list also consider as a tuple, which means the function that accept a single tuple should always be flattened.</div><div><br></div><div><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="color:rgb(186,45,162)">let</span> fn1: (<span style="color:rgb(112,61,170)">Int</span>, <span style="color:rgb(112,61,170)">Int</span>) -&gt; <span style="color:rgb(112,61,170)">Void</span> = { <span style="color:rgb(186,45,162)">_</span>, <span style="color:rgb(186,45,162)">_</span> <span style="color:rgb(186,45,162)">in</span> }</p><p style="margin:0px;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="color:rgb(0,132,0)"><br></span></p><span style="font-family:Menlo;font-size:11px;color:rgb(186,45,162)">let</span><span style="color:rgb(0,0,0);font-family:Menlo;font-size:11px"> fn2: ((</span><span style="font-family:Menlo;font-size:11px;color:rgb(112,61,170)">Int</span><span style="color:rgb(0,0,0);font-family:Menlo;font-size:11px">, </span><span style="font-family:Menlo;font-size:11px;color:rgb(112,61,170)">Int</span><span style="color:rgb(0,0,0);font-family:Menlo;font-size:11px">)) -&gt; </span><span style="font-family:Menlo;font-size:11px;color:rgb(112,61,170)">Void</span><span style="color:rgb(0,0,0);font-family:Menlo;font-size:11px"> = { </span><span style="font-family:Menlo;font-size:11px;color:rgb(186,45,162)">_</span><span style="color:rgb(0,0,0);font-family:Menlo;font-size:11px">, </span><span style="font-family:Menlo;font-size:11px;color:rgb(186,45,162)">_</span><span style="color:rgb(0,0,0);font-family:Menlo;font-size:11px"> </span><span style="font-family:Menlo;font-size:11px;color:rgb(186,45,162)">in</span><span style="color:rgb(0,0,0);font-family:Menlo;font-size:11px"> }  </span><span style="font-family:Menlo;font-size:11px;color:rgb(0,132,0)">// always flattened</span></div><div><span style="font-family:Menlo;font-size:11px;color:rgb(186,45,162)"><br></span></div><div><span style="font-family:Menlo;font-size:11px;color:rgb(186,45,162)">let</span><span style="color:rgb(0,0,0);font-family:Menlo;font-size:11px"> fn3: (</span><span style="font-family:Menlo;font-size:11px;color:rgb(112,61,170)">Int</span><span style="color:rgb(0,0,0);font-family:Menlo;font-size:11px">, </span><span style="font-family:Menlo;font-size:11px;color:rgb(112,61,170)">Int</span><span style="color:rgb(0,0,0);font-family:Menlo;font-size:11px">) -&gt; </span><span style="font-family:Menlo;font-size:11px;color:rgb(112,61,170)">Void</span><span style="color:rgb(0,0,0);font-family:Menlo;font-size:11px"> = { </span><span style="font-family:Menlo;font-size:11px;color:rgb(186,45,162)">_</span><span style="color:rgb(0,0,0);font-family:Menlo;font-size:11px"> </span><span style="font-family:Menlo;font-size:11px;color:rgb(186,45,162)">in</span><span style="color:rgb(0,0,0);font-family:Menlo;font-size:11px"> }  </span><span style="font-family:Menlo;font-size:11px;color:rgb(0,132,0)">// not allowed, here are two arguments</span></div><div><span style="font-family:Menlo;font-size:11px;color:rgb(0,132,0)"><br></span></div><span style="font-family:Menlo;font-size:11px;color:rgb(186,45,162)">let</span><span style="color:rgb(0,0,0);font-family:Menlo;font-size:11px"> fn4: ((</span><span style="font-family:Menlo;font-size:11px;color:rgb(112,61,170)">Int</span><span style="color:rgb(0,0,0);font-family:Menlo;font-size:11px">, </span><span style="font-family:Menlo;font-size:11px;color:rgb(112,61,170)">Int</span><span style="color:rgb(0,0,0);font-family:Menlo;font-size:11px">)) -&gt; </span><span style="font-family:Menlo;font-size:11px;color:rgb(112,61,170)">Void</span><span style="color:rgb(0,0,0);font-family:Menlo;font-size:11px"> = { </span><span style="font-family:Menlo;font-size:11px;color:rgb(186,45,162)">_</span><span style="color:rgb(0,0,0);font-family:Menlo;font-size:11px"> </span><span style="font-family:Menlo;font-size:11px;color:rgb(186,45,162)">in</span><span style="color:rgb(0,0,0);font-family:Menlo;font-size:11px"> }  </span><span style="font-family:Menlo;font-size:11px;color:rgb(0,132,0)">// not allowed, here are two arguments</span><div><br></div></div>
</blockquote></div></div></div><br></div>
<br>______________________________<wbr>_________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br>
<br></blockquote></div><br></div></div>