<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="">Fair enough. Can we get an explicit, well-designed version of this before we get rid of the implicit, poorly-designed version?<div class=""><br class=""></div><div class="">I can’t recall off the top my head where, but I <i class="">know</i> I’ve done something like this:</div><div class=""><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="">struct</span> FunctionApplicator &lt;T, U&gt; {</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="">var</span> args: <span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">T</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="">let</span> function: <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="">init</span>(args: <span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">T</span>, function: <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; &nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">self</span>.<span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">args</span> = args</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; &nbsp; &nbsp; <span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">self</span>.<span style="font-variant-ligatures: no-common-ligatures; color: #4f8187" class="">function</span> = function</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; }</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="">func</span> apply() -&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; color: rgb(79, 129, 135);" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">&nbsp; &nbsp; &nbsp; &nbsp; </span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">return</span><span style="font-variant-ligatures: no-common-ligatures; color: #000000" class=""> </span>function<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">(</span>args<span style="font-variant-ligatures: no-common-ligatures; color: #000000" class="">)</span></div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">&nbsp; &nbsp; }</div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class="">}</div></div><div class=""><br class=""></div><div class="">Without tuple splatting, you’d need a&nbsp;<span style="font-family: Menlo; font-size: 11px;" class="">FunctionApplicator1&lt;T,U&gt;</span>,&nbsp;<span style="font-family: Menlo; font-size: 11px;" class="">FunctionApplicator2&lt;T,U,V&gt;</span>,&nbsp;<span style="font-family: Menlo; font-size: 11px;" class="">FunctionApplicator3&lt;T,U,V,W&gt;</span>, etc. They can’t even have the same name because Swift doesn’t support overloading type names for types with a different number of generic parameters.</div><div class=""><br class=""><div class="">
- Dave Sweeris

</div>
<br class=""><div><blockquote type="cite" class=""><div class="">On Jan 27, 2016, at 08:48, Matthew Johnson via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><blockquote type="cite" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class="Apple-interchange-newline">On Jan 27, 2016, at 4:18 AM, Nisse Bergman via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<br class=""><br class="">-1 I use this in both my mocking API and in JSON deserialising/serializing.<br class="">I think this is a great thing to have<br class=""></blockquote><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; float: none; display: inline !important;" class="">It would be great to have an explicit, well-designed version of this. &nbsp;Nobody is arguing against that. &nbsp;But there are quite a few problems with its current form.</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""></div></blockquote></div><br class=""></div></body></html>