<div dir="ltr">a PR is create: <a href="https://github.com/apple/swift-evolution/pull/722">https://github.com/apple/swift-evolution/pull/722</a></div><div class="gmail_extra"><br><div class="gmail_quote">2017-06-07 10:15 GMT+08:00 Susan Cheng <span dir="ltr"><<a href="mailto:susan.doggie@gmail.com" target="_blank">susan.doggie@gmail.com</a>></span>:<br><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,'Segoe UI',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol'">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,'Segoe UI',Helvetica,Arial,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol'">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>) -> <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">)) -> </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">) -> </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">)) -> </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><br></div>