<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=""><div class="">In current Swift, this approach does not preserve argument labels :</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">let</span> partial1 = { <span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">projectFunctionToCoordinateSystem</span>(function: mySinFunction, p0: p0, p1: p1, x: $0) } <span style="font-variant-ligatures: no-common-ligatures; color: #008400" class="">// (CGFloat) -> CGPoint</span></div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">let</span> partial2 = { <span style="font-variant-ligatures: no-common-ligatures; color: #31595d" class="">projectFunctionToCoordinateSystem</span>(function: mySinFunction, p0: .zero, p1: $0, x: $1) } <span style="font-variant-ligatures: no-common-ligatures; color: #008400" class="">// (CGPoint, CGFloat) -> CGPoint</span></div></div><div class=""><span style="font-variant-ligatures: no-common-ligatures; color: #008400" class=""><br class=""></span></div><div class=""><br class=""></div><div class="">must be called <font face="Menlo" class="">partial1(0.5)</font>, not <font face="Menlo" class="">partial1(x: 0.5)</font>, unless you go to some significant work, as in the following:</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">let</span> partial1: (x: <span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">CGFloat</span>) -> <span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">CGPoint</span> = {</div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo;" class=""> <span style="color: rgb(49, 89, 93);" class="">projectFunctionToCoordinateSystem</span>(function: <span style="color: rgb(49, 89, 93);" class="">mySinFunction</span>, p0: <span style="color: rgb(79, 129, 135);" class="">p0</span>, p1: <span style="color: rgb(79, 129, 135);" class="">p1</span>, x: $0) </div><div style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo;" class="">}</div></div><div class=""><br class=""></div><div class="">It's not that this is undoable, it's just ugly and laborious, things that are un-Swifty. You must decide a priori which arguments will be applied, and manually name those that will not.</div><div class=""><br class=""></div><div class="">Compare with, for example, an imaginary version that uses $$ to accomplish the same with less planning and greater win:</div><div class=""><br class=""></div><div class=""><span style="font-family: Menlo; font-size: 18px; color: rgb(187, 44, 162);" class="">let</span><span style="font-family: Menlo; font-size: 18px;" class=""> partial1 = </span><span style="font-family: Menlo; font-size: 18px; color: rgb(49, 89, 93);" class="">projectFunctionToCoordinateSystem</span><span style="font-family: Menlo; font-size: 18px;" class="">(function: mySinFunction, p0: p0, p1: p1, x: $$) </span><span style="font-family: Menlo; font-size: 18px; color: rgb(0, 132, 0);" class="">// (x: CGFloat) -> CGPoint</span></div><div class=""><br class=""></div>I find it a lot cleaner, less crufty™ and nicer to use than jerry-rigging with a closure.<div class=""><br class=""></div><div class="">-- E</div><div class=""><br class=""><div class=""><div><blockquote type="cite" class=""><div class="">On Feb 2, 2016, at 3:40 PM, Howard Lovatt via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class="">Much prefer the syntax suggested by Greg that uses {} and $n<div class=""><br class="">On Wednesday, 3 February 2016, Greg Titus via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word" class=""><div class="">What about $N? :-) </div><div class=""><br class=""></div><div class="">And then you could also put {} around it so that it is more obvious that partial1 is being assigned something that acts like a closure, and then you end up with:</div><div class=""><br class=""></div><div class="">let partial1 = { projectFunctionToCoordinateSystem(function: mySinFunction, p0: p0, p1: p1, x: $0) }<br class="">let partial2 = { projectFunctionToCoordinateSystem(function: mySinFunction, p0: .zero, p1: $0, x: $1) }<br class=""><div class=""><br class=""></div></div><div class="">instead of:</div><div class=""><blockquote type="cite" class="">let partial1 = projectFunctionToCoordinateSystem(function: mySinFunction, p0: p0, p1: p1, x: _) <br class="">let partial2 = projectFunctionToCoordinateSystem(function: mySinFunction, p0: .zero, p1: _, x: _) <br class=""></blockquote><div class=""><br class=""></div><div class="">I’m -1.</div></div><div class=""><br class=""></div><div class="">With the way that single expression closures work, and the fact that they are so syntactically light, I don’t think that this proposal would add utility, it would just be one more construct to learn.</div><div class=""><br class=""></div><div class=""><span style="white-space:pre-wrap" class="">        </span>- Greg</div><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Feb 2, 2016, at 10:28 AM, Gwendal Roué via swift-evolution <<a href="javascript:_e(%7B%7D,'cvml','swift-evolution@swift.org');" target="_blank" class="">swift-evolution@swift.org</a>> wrote:</div><br class=""><div class=""><div style="word-wrap:break-word" class="">What about nothing?<div class=""><br class=""></div><div class=""><div class=""><div style="word-wrap:break-word" class=""><div class=""><div class=""><div style="word-wrap:break-word" class=""><div class=""><div class=""><div class=""><div style="word-wrap:break-word" class=""><div class=""><div class=""><div style="word-wrap:break-word" class=""><div class=""><div style="margin-bottom:16px;color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,'Segoe UI',Arial,freesans,sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol';font-size:16px;background-color:rgb(255,255,255)" 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;word-break:normal" class=""><span style="color:rgb(167,29,93)" class="">let</span> partial1 <span style="color:rgb(167,29,93)" class="">=</span> f(arg1: 1, arg2:)</pre></div></div></div></div></div></div></div></div></div></div></div></div></div></div><div class="">Gwendal</div><div class=""><br class=""><blockquote type="cite" class="">Le 2 févr. 2016 à 19:26, Gwendal Roué <<a href="javascript:_e(%7B%7D,'cvml','gwendal.roue@gmail.com');" target="_blank" class="">gwendal.roue@gmail.com</a>> a écrit :<br class=""><br class="">Any operator character would be bad, since the function may accept it, as in `[1,2,3].reduce(1, combine: *)`<br class=""><br class="">Gwendal<br class=""><br class=""><blockquote type="cite" class="">Le 2 févr. 2016 à 19:24, Erica Sadun via swift-evolution <<a href="javascript:_e(%7B%7D,'cvml','swift-evolution@swift.org');" target="_blank" class="">swift-evolution@swift.org</a>> a écrit :<br class=""><br class=""><br class=""><blockquote type="cite" class="">On Feb 2, 2016, at 11:20 AM, Chris Lattner <<a href="javascript:_e(%7B%7D,'cvml','clattner@apple.com');" target="_blank" class="">clattner@apple.com</a>> wrote:<br class=""><br class="">On Feb 2, 2016, at 10:16 AM, Erica Sadun <<a href="javascript:_e(%7B%7D,'cvml','erica@ericasadun.com');" target="_blank" class="">erica@ericasadun.com</a>> wrote:<br class=""><blockquote type="cite" class=""><blockquote type="cite" class=""><br class="">One superficial comment on this: the use of _ here is a bad idea. _ already means something in expressions - “discard”, and a closely related thing in declarations - “ignore”. <br class=""><br class="">Adding a third very different thing (placeholder to be filled in later) seems like a really confusing thing to do.<br class=""><br class="">-Chris<br class=""><br class=""></blockquote><br class=""><br class="">#?<br class=""></blockquote><br class=""># means “macro like” or “compiler synthesized”.<br class=""><br class="">-Chris<br class=""><br class=""></blockquote><br class="">* would be bad, right? And naked ?-marks?<br class=""><br class="">-- E<br class=""><br class="">_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="javascript:_e(%7B%7D,'cvml','swift-evolution@swift.org');" target="_blank" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></blockquote><br class=""></blockquote><br class=""></div></div></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="javascript:_e(%7B%7D,'cvml','swift-evolution@swift.org');" target="_blank" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" target="_blank" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class=""></div></blockquote></div><br class=""><br class="">-- <br class=""> -- Howard.<br class=""><br class="">
_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></div></div></body></html>