<div dir="ltr">Hi Joe,<div><br></div><div>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><br></div><div><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)"><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><br></div><div>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><br></div><div><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)"><p style="font-family:Menlo;font-size:11px;margin:0px;line-height:normal"><span style="color:rgb(187,44,162)">func</span> call<T,U>(value: <span style="color:rgb(112,61,170)">T</span>, apply: <span style="color:rgb(112,61,170)">T</span>-><span style="color:rgb(112,61,170)">U</span>) -> <span style="color:rgb(112,61,170)">U</span> {</p><p style="margin:0px;line-height:normal"><font face="Consolas, Liberation Mono, Menlo, Courier, monospace"><span style="font-size:14px"> </span></font><span style="font-family:Menlo;font-size:11px"> <span style="color:rgb(187,44,162)">return</span> apply(value)</span></p><p style="font-family:Menlo;font-size:11px;margin:0px;line-height:normal">}</p><p style="font-family:Menlo;font-size:11px;margin:0px;line-height:normal"><span style="color:rgb(187,44,162)">func</span> call2<T,U>(apply: <span style="color:rgb(112,61,170)">T</span>-><span style="color:rgb(112,61,170)">U</span>) -> (<span style="color:rgb(112,61,170)">T</span> -> <span style="color:rgb(112,61,170)">U</span>) {</p><p style="font-family:Menlo;font-size:11px;margin:0px;line-height:normal"> <span style="color:rgb(187,44,162)">return</span> { apply($0) }</p><p style="font-family:Menlo;font-size:11px;margin:0px;line-height:normal">}</p><p style="font-family:Menlo;font-size:11px;margin:0px;line-height:normal"><span style="color:rgb(187,44,162)">func</span> test(a: <span style="color:rgb(112,61,170)">Int</span>, b: <span style="color:rgb(112,61,170)">Int</span>, c: <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)">Int</span>) {</p><p style="font-family:Menlo;font-size:11px;margin:0px;line-height:normal"> <span style="color:rgb(187,44,162)">return</span> (a + b, b + c)</p><p style="font-family:Menlo;font-size:11px;margin:0px;line-height:normal">}</p><font face="Consolas, Liberation Mono, Menlo, Courier, monospace"><span style="font-size:14px">
</span></font><p style="font-family:Menlo;font-size:11px;margin:0px;line-height:normal"><span style="color:rgb(187,44,162)">let</span> a = <span style="color:rgb(49,89,93)">call</span>((<span style="color:rgb(39,42,216)">1</span>, <span style="color:rgb(39,42,216)">2</span>, <span style="color:rgb(39,42,216)">3</span>), apply: <span style="color:rgb(49,89,93)">test</span>)</p><p style="font-family:Menlo;font-size:11px;margin:0px;line-height:normal"><span style="color:rgb(187,44,162)">let</span> b = <span style="color:rgb(49,89,93)">call2</span>(<span style="color:rgb(49,89,93)">test</span>)(<span style="color:rgb(39,42,216)">1</span>, <span style="color:rgb(39,42,216)">2</span>, <span style="color:rgb(39,42,216)">3</span>)</p></pre></div><div><br></div><div>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)">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><br></div><div><b>If it is invalid:</b></div><div><ul><li>Should the compiler only allow (<span style="font-family:Menlo;font-size:11px;white-space:pre;color:rgb(112,61,170)">T</span><span style="color:rgb(51,51,51);font-family:Menlo;font-size:11px;white-space:pre;background-color:rgb(247,247,247)">-></span><span style="font-family:Menlo;font-size:11px;white-space:pre;color:rgb(112,61,170)">U</span>) to be a function from a single value?</li><li>Should a change to closure type signatures be more explicit in the proposal?</li><li>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)">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)">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)">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>I don't believe a compiler fixit could resolve this without duplicating <span style="color:rgb(51,51,51);font-family:Menlo;font-size:11px;white-space:pre;background-color:rgb(247,247,247)">call</span> and <span style="color:rgb(51,51,51);font-family:Menlo;font-size:11px;white-space:pre;background-color:rgb(247,247,247)">call2</span> for different arities, that only works if they are in a module under the user's control.</div><div><br></div><div><div>A more common example can be seen in:</div><div> <font face="monospace, monospace">/swift/stdlib/internal/SwiftExperimental/SwiftExperimental.swift</font><br></div><div><br></div>The function composition operator "(<font face="monospace, monospace">f ∘ g)(1,2,3)</font>".<br></div><div><br></div><div><b>Preliminary review:</b></div><div><br></div><div>In general I'm in favour, it seems like a necessary fix. I can see it being a potential for confusion in most cases. I think it's unclear how many flow-on effects there may be, and perhaps the impact is underestimated.</div><div><br></div><div>However it would be a shame to lose useful function composition utilities, I believe it is only potentially confusing for the few people writing those utilities, not for the many people using them.</div><div><br></div><div>Thanks,</div><div>Andrew</div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Feb 6, 2016 at 8:31 AM, Joseph Lord via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div><span></span></div><div><div>+1<br><br></div><div>While I liked the idea the fact it can't be used to operate on a returned tuple directly means that it can't be used in the most interesting ways from the functional world (I raised a radar on that rdar://17356912). I also understand the danger of the implicit nature. </div><div><br></div><div>In most app development I haven't used the feature. </div><div><br></div><div>While I think a proper explicit splat operator would be nice it is definitely low priority and the specification would need some thought and the main use might be teaching functional fundamentals so I'm not sure how much real use it would get.</div><div><br></div><div>Joseph</div><div><div class="h5"><div><br>On 5 Feb 2016, at 18:12, Joe Groff <<a href="mailto:jgroff@apple.com" target="_blank">jgroff@apple.com</a>> wrote:<br><br></div><blockquote type="cite"><div>Hello Swift community,<br><br>The review of “Remove implicit tuple splat behavior from function applications” begins now and runs through February 9, 2016. The proposal is available here:<br><br><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0029-remove-implicit-tuple-splat.md" target="_blank">https://github.com/apple/swift-evolution/blob/master/proposals/0029-remove-implicit-tuple-splat.md</a></blockquote><div><br>Reviews are an important part of the Swift evolution process. All reviews should be sent to the swift-evolution mailing list at<br><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote><div><br>or, if you would like to keep your feedback private, directly to the review manager. When replying, please try to keep the proposal link at the top of the message:<br><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>Proposal link:</div><div><br></div><div><a href="http://github.com/apple/swift-evolution/blob/master/proposals/0029-remove-implicit-tuple-splat.md" target="_blank">http://github.com/apple/swift-evolution/blob/master/proposals/0029-remove-implicit-tuple-splat.md</a></div><div><br></div><div>Reply text</div><div><br></div><div>Other replies</div><div><br></div></blockquote><div><b>What goes into a review?<br></b><br>The goal of the review process is to improve the proposal under review through constructive criticism and, eventually, determine the direction of Swift. When writing your review, here are some questions you might want to answer in your review:<br><br><div><span style="white-space:pre-wrap">        </span>• What is your evaluation of the proposal?<br></div><div><span style="white-space:pre-wrap">        </span>• Is the problem being addressed significant enough to warrant a change to Swift?<br></div><div><span style="white-space:pre-wrap">        </span>• Does this proposal fit well with the feel and direction of Swift?<br></div><div><span style="white-space:pre-wrap">        </span>• If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?<br></div><div><span style="white-space:pre-wrap">        </span>• How much effort did you put into your review? A glance, a quick reading, or an in-depth study?<br></div><div><br></div>More information about the Swift evolution process is available at<br><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><a href="https://github.com/apple/swift-evolution/blob/master/process.md" target="_blank">https://github.com/apple/swift-evolution/blob/master/process.md</a></div></blockquote><div><br>Thank you,<br><br>-Joe<br>Review Manager</div></div></blockquote></div></div><blockquote type="cite"><div><span>_______________________________________________</span><br><span>swift-evolution-announce mailing list</span><br><span><a href="mailto:swift-evolution-announce@swift.org" target="_blank">swift-evolution-announce@swift.org</a></span><br><span><a href="https://lists.swift.org/mailman/listinfo/swift-evolution-announce" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution-announce</a></span><br></div></blockquote></div></div><br>_______________________________________________<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/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div>