<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 5, 2016, at 3:54 PM, Andrew Bennett <<a href="mailto:cacoyi@gmail.com" class="">cacoyi@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Hi Joe,<div class=""><br class=""></div><div class="">I'm sorry to bring up the "common point of confusion", but I'd like a little more clarification to help me review :). Your example of valid syntax is this:</div><div class=""><br class=""></div><div class=""><pre style="overflow:auto;font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:14px;margin-top:0px;margin-bottom:0px;line-height:1.45;padding:16px;background-color:rgb(247,247,247);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wrap:normal;color:rgb(51,51,51)" class=""><span class="" style="color:rgb(167,29,93)">func</span> <span class="" style="color:rgb(121,93,163)">f2</span><T>(a <span class="" style="color:rgb(167,29,93)">:</span> T) <span class="" style="color:rgb(167,29,93)">-></span> T { <span class="" style="color:rgb(167,29,93)">...</span> }
<span class="" style="color:rgb(167,29,93)">let</span> x <span class="" style="color:rgb(167,29,93)">=</span> (<span class="" style="color:rgb(0,134,179)">1</span>, <span class="" style="color:rgb(0,134,179)">2</span>)
f2(x)</pre></div><div class=""><br class=""></div><div class="">It gets a little more complicated when generic closures are involved. I am wondering which aspects of this (if any) will still valid:</div><div class=""><br class=""></div><div class=""><pre style="overflow:auto;margin-top:0px;margin-bottom:0px;line-height:1.45;padding:16px;background-color:rgb(247,247,247);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;word-wrap:normal;color:rgb(51,51,51)" class=""><div style="font-family: Menlo; font-size: 11px; margin: 0px; line-height: normal;" class=""><span style="color:rgb(187,44,162)" class="">func</span> call<T,U>(value: <span style="color:rgb(112,61,170)" class="">T</span>, apply: <span style="color:rgb(112,61,170)" class="">T</span>-><span style="color:rgb(112,61,170)" class="">U</span>) -> <span style="color:rgb(112,61,170)" class="">U</span> {</div><div style="margin: 0px; line-height: normal;" class=""><font face="Consolas, Liberation Mono, Menlo, Courier, monospace" class=""><span style="font-size:14px" class=""> </span></font><span style="font-family:Menlo;font-size:11px" class=""> <span style="color:rgb(187,44,162)" class="">return</span> apply(value)</span></div><div style="font-family: Menlo; font-size: 11px; margin: 0px; line-height: normal;" class="">}</div><div style="font-family: Menlo; font-size: 11px; margin: 0px; line-height: normal;" class=""><span style="color:rgb(187,44,162)" class="">func</span> call2<T,U>(apply: <span style="color:rgb(112,61,170)" class="">T</span>-><span style="color:rgb(112,61,170)" class="">U</span>) -> (<span style="color:rgb(112,61,170)" class="">T</span> -> <span style="color:rgb(112,61,170)" class="">U</span>) {</div><div style="font-family: Menlo; font-size: 11px; margin: 0px; line-height: normal;" class=""> <span style="color:rgb(187,44,162)" class="">return</span> { apply($0) }</div><div style="font-family: Menlo; font-size: 11px; margin: 0px; line-height: normal;" class="">}</div><div style="font-family: Menlo; font-size: 11px; margin: 0px; line-height: normal;" class=""><span style="color:rgb(187,44,162)" class="">func</span> test(a: <span style="color:rgb(112,61,170)" class="">Int</span>, b: <span style="color:rgb(112,61,170)" class="">Int</span>, c: <span style="color:rgb(112,61,170)" class="">Int</span>) -> (<span style="color:rgb(112,61,170)" class="">Int</span>, <span style="color:rgb(112,61,170)" class="">Int</span>) {</div><div style="font-family: Menlo; font-size: 11px; margin: 0px; line-height: normal;" class=""> <span style="color:rgb(187,44,162)" class="">return</span> (a + b, b + c)</div><div style="font-family: Menlo; font-size: 11px; margin: 0px; line-height: normal;" class="">}</div><font face="Consolas, Liberation Mono, Menlo, Courier, monospace" class=""><span style="font-size:14px" class="">
</span></font><div style="font-family: Menlo; font-size: 11px; margin: 0px; line-height: normal;" class=""><span style="color:rgb(187,44,162)" class="">let</span> a = <span style="color:rgb(49,89,93)" class="">call</span>((<span style="color:rgb(39,42,216)" class="">1</span>, <span style="color:rgb(39,42,216)" class="">2</span>, <span style="color:rgb(39,42,216)" class="">3</span>), apply: <span style="color:rgb(49,89,93)" class="">test</span>)</div><div style="font-family: Menlo; font-size: 11px; margin: 0px; line-height: normal;" class=""><span style="color:rgb(187,44,162)" class="">let</span> b = <span style="color:rgb(49,89,93)" class="">call2</span>(<span style="color:rgb(49,89,93)" class="">test</span>)(<span style="color:rgb(39,42,216)" class="">1</span>, <span style="color:rgb(39,42,216)" class="">2</span>, <span style="color:rgb(39,42,216)" class="">3</span>)</div></pre></div><div class=""><br class=""></div><div class="">By my interpretation <span style="color:rgb(51,51,51);font-family:Menlo;font-size:11px;white-space:pre;background-color:rgb(247,247,247)" class="">apply</span> uses "pass an entire argument list as a single value", so it would be invalid. However I don't think it has the same syntactic ambiguity that you talked about in your proposal.</div><div class=""><br class=""></div><div class=""><b class="">If it is invalid:</b></div><div class=""><ul class=""><li class="">Should the compiler only allow (<span style="font-family:Menlo;font-size:11px;white-space:pre;color:rgb(112,61,170)" class="">T</span><span style="color:rgb(51,51,51);font-family:Menlo;font-size:11px;white-space:pre;background-color:rgb(247,247,247)" class="">-></span><span style="font-family:Menlo;font-size:11px;white-space:pre;color:rgb(112,61,170)" class="">U</span>) to be a function from a single value?</li></ul></div></div></div></blockquote><div>Yeah, AIUI.</div><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><ul class=""><li class="">Should a change to closure type signatures be more explicit in the proposal?</li></ul></div></div></div></blockquote><div>I think so. It'd probably be a good idea to at least change the syntax to require parens around the argument list, (T) -> U, to make this more apparent.</div><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><ul class=""><li class="">You mention a <span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:14px;background-color:rgb(247,247,247)" class="">foo(</span><span class="" style="font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:14px;background-color:rgb(247,247,247);color:rgb(167,29,93)">*</span><span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:14px;background-color:rgb(247,247,247)" class="">x)</span> style solution, this would probably also require <span style="color:rgb(51,51,51);font-family:Consolas,'Liberation Mono',Menlo,Courier,monospace;font-size:14px;background-color:rgb(247,247,247)" class="">T*</span> equivalent. Is this something that you view as inevitable, do you think it will be considered within the Swift4 timeframe?</li></ul></div></div></div></blockquote><div>We're definitely interested in designing a proper solution to this, so that useful generic utilities can still be written. When it lands depends on when we have bandwidth to design and implement it.</div><div><br class=""></div><div>-Joe</div></div></body></html>