<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="">On Jan 27, 2016, at 12:53 PM, Chris Lattner via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><div><blockquote type="cite" class=""><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=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Jan 27, 2016, at 10:46 AM, <a href="mailto:davesweeris@mac.com" class="">davesweeris@mac.com</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=""><div class="">&lt;scratches head&gt; Then I’ve misunderstood what splatting was. Is the difference between splatting and what my example does the arguments’ labels?</div><div class=""><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);" class=""><div style="margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">func</span> f(a : <span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Int</span>, <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">_</span> b : <span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">Int</span>) {…}</div></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">let</span><span style="" class=""> x = </span>FunctionApplicator<span style="" class="">((</span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">42</span><span style="" class="">, b: </span><span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">19</span><span style="" class="">), f)</span><span style="" class="">&nbsp;</span><span style="color: rgb(0, 132, 0);" class="">//Would stay legal, because of the "b:"</span></div></div><div class=""><div class=""><div style="margin: 0px; line-height: normal;" class=""><span style="color: rgb(187, 44, 162); font-family: Menlo; font-size: 11px;" class="">let</span><span style="font-family: Menlo; font-size: 11px;" class="">&nbsp;y&nbsp;=&nbsp;</span><font color="#4f8187" face="Menlo" class=""><span style="font-size: 11px;" class="">FunctionApplicator</span></font><span style="font-family: Menlo; font-size: 11px;" class="">((</span><span style="color: rgb(39, 42, 216); font-family: Menlo; font-size: 11px;" class="">42</span><span style="font-family: Menlo; font-size: 11px;" class="">, </span><span style="color: rgb(39, 42, 216); font-family: Menlo; font-size: 11px;" class="">19</span><span style="font-family: Menlo; font-size: 11px;" class="">), f)</span><span style="font-family: Menlo; font-size: 11px;" class="">&nbsp; &nbsp;&nbsp;</span><font color="#008400" face="Menlo" class=""><span style="font-size: 11px;" class="">//Would become illegal, because there’s no “b:”</span></font></div></div></div></div></div></blockquote><div class=""><br class=""></div><div class="">There is no change to either of these. &nbsp;The later example succeed because of an implicit conversion from "(T,U) -&gt; (T, b: U)”, which is an entirely separate thing.</div><div class=""><br class=""></div><div class="">The tuple splat behavior I’m talking about can *only* affect call sites that take a single argument. &nbsp;Both of these examples take two.</div><div class=""><br class=""></div><div class="">-Chris</div></div></div></div></blockquote></div><br class=""><div class=""><br class=""></div><div class="">I thought Dave had a good point with his first generics example before, but don’t understand what the point was with labeling that he makes above. &nbsp;However, there is a call site that takes a single argument in his example:</div><div class=""><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="color: rgb(187, 44, 162);">func</span>&nbsp;apply() -&gt;&nbsp;<span class="" style="color: rgb(112, 61, 170);">U</span>&nbsp;{</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; color: rgb(79, 129, 135);"><span class="" style="color: rgb(0, 0, 0);">&nbsp; &nbsp; </span><span class="" style="color: rgb(187, 44, 162);">return</span><span class="" style="color: rgb(0, 0, 0);">&nbsp;</span>function<span class="" style="color: rgb(0, 0, 0);">(</span>args<span class="" style="color: rgb(0, 0, 0);">)</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">}</div></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><br class=""></div><div class="" style="margin: 0px; line-height: normal;">Where args could be a tuple of type T.</div><div class="" style="margin: 0px; line-height: normal;"><br class=""></div><div class="" style="margin: 0px; line-height: normal;">I just want to be clear on this. &nbsp;I’ll put the question a bit more succinctly. &nbsp;Wouldn’t this functionality be eliminated with the removal of tuple splatting?</div><div class="" style="margin: 0px; line-height: normal;"><br class=""></div><div class="" style="margin: 0px; line-height: normal;"><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class=""><b class="">func</b></span> execute&lt;T,U&gt;(f: <span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">T</span>-&gt;<span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">U</span>, args: <span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">T</span>) -&gt; <span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">U</span> {</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class=""><b class="">return</b></span> f(args)</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div><div style="margin: 0px; line-height: normal;" class=""><div style="font-family: Menlo; font-size: 11px; margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">execute</span>({$0+<span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">1</span>}, args: <span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">5</span>)&nbsp;<span style="color: rgb(0, 132, 0);" class="">// Single arg</span></div><div style="font-family: Menlo; font-size: 11px; margin: 0px; line-height: normal;" class=""><div style="margin: 0px; line-height: normal; color: rgb(0, 132, 0);" class="">//6</div></div><div style="margin: 0px; line-height: normal;" class=""><div style="font-family: Menlo; font-size: 11px; margin: 0px; line-height: normal;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">execute</span>(*, args: (<span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">5</span>,<span style="font-variant-ligatures: no-common-ligatures; color: #272ad8" class="">5</span>))&nbsp;<span style="color: rgb(0, 132, 0);" class="">// Tuple arg</span></div><div style="margin: 0px; line-height: normal;" class=""><div style="font-family: Menlo; font-size: 11px; margin: 0px; line-height: normal; color: rgb(0, 132, 0);" class="">//25</div><div style="font-family: Menlo; font-size: 11px; margin: 0px; line-height: normal; color: rgb(0, 132, 0);" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">In this generic function, args can be either a single argument *or* a tuple of arguments that gets applied to the function.</div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">Having said that, I’m not sure what the real use cases or practical value of this is. &nbsp;Perhaps like a lot of people, I thought Swift’s features like function currying and tuple splatting were *cool* but in reality never used them. &nbsp;Although I think the generics context is something to consider, I still give the proposal +1. &nbsp;Tuple splatting looks to be a feature that can’t pull its own weight and has downsides because of syntactic ambiguity.</div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class=""><br class=""></div><div style="margin: 0px; line-height: normal;" class="">-Chris Whidden</div></div></div></div></div></body></html>