<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Feb 2, 2016, at 3:58 PM, Erica Sadun <<a href="mailto:erica@ericasadun.com" class="">erica@ericasadun.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div 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=""><blockquote type="cite" class=""><div class=""><br class="Apple-interchange-newline">On Feb 2, 2016, at 4:42 PM, Joe Groff <<a href="mailto:jgroff@apple.com" class="">jgroff@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="font-family: Palatino-Roman; font-size: 14px; 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;"><blockquote type="cite" class=""><div class=""><br class="Apple-interchange-newline">On Feb 2, 2016, at 3:03 PM, Erica Sadun 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=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class="">In current Swift, this approach does not preserve argument labels :</div><div class=""><br class=""></div><div class=""><div class="" style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo;"><span class="" style="color: rgb(187, 44, 162);">let</span><span class="Apple-converted-space"> </span>partial1 = {<span class="Apple-converted-space"> </span><span class="" style="color: rgb(49, 89, 93);">projectFunctionToCoordinateSystem</span>(function: mySinFunction, p0: p0, p1: p1, x: $0) }<span class="Apple-converted-space"> </span><span class="" style="color: rgb(0, 132, 0);">// (CGFloat) -> CGPoint</span></div><div class="" style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo;"><span class="" style="color: rgb(187, 44, 162);">let</span><span class="Apple-converted-space"> </span>partial2 = {<span class="Apple-converted-space"> </span><span class="" style="color: rgb(49, 89, 93);">projectFunctionToCoordinateSystem</span>(function: mySinFunction, p0: .zero, p1: $0, x: $1) }<span class="Apple-converted-space"> </span><span class="" style="color: rgb(0, 132, 0);">// (CGPoint, CGFloat) -> CGPoint</span></div></div><div class=""><span class="" style="color: rgb(0, 132, 0);"><br class=""></span></div><div class=""><br class=""></div><div class="">must be called<span class="Apple-converted-space"> </span><font face="Menlo" class="">partial1(0.5)</font>, not<span class="Apple-converted-space"> </span><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 class="" style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo;"><span class="" style="color: rgb(187, 44, 162);">let</span><span class="Apple-converted-space"> </span>partial1: (x:<span class="Apple-converted-space"> </span><span class="" style="color: rgb(112, 61, 170);">CGFloat</span>) -><span class="Apple-converted-space"> </span><span class="" style="color: rgb(112, 61, 170);">CGPoint</span><span class="Apple-converted-space"> </span>= {</div><div class="" style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo;"> <span class="" style="color: rgb(49, 89, 93);">projectFunctionToCoordinateSystem</span>(function:<span class="Apple-converted-space"> </span><span class="" style="color: rgb(49, 89, 93);">mySinFunction</span>, p0:<span class="Apple-converted-space"> </span><span class="" style="color: rgb(79, 129, 135);">p0</span>, p1:<span class="Apple-converted-space"> </span><span class="" style="color: rgb(79, 129, 135);">p1</span>, x: $0) </div><div class="" style="margin: 0px; font-size: 18px; line-height: normal; font-family: Menlo;">}</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 class="" style="font-family: Menlo; font-size: 18px; color: rgb(187, 44, 162);">let</span><span class="" style="font-family: Menlo; font-size: 18px;"> partial1 =<span class="Apple-converted-space"> </span></span><span class="" style="font-family: Menlo; font-size: 18px; color: rgb(49, 89, 93);">projectFunctionToCoordinateSystem</span><span class="" style="font-family: Menlo; font-size: 18px;">(function: mySinFunction, p0: p0, p1: p1, x: $$) </span><span class="" style="font-family: Menlo; font-size: 18px; color: rgb(0, 132, 0);">// (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></div></blockquote><br class=""></div><div class="" style="font-family: Palatino-Roman; font-size: 14px; 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;">Closures having unlabeled arguments is a feature, IMO. Propagating labels through the function type system introduces type differences where there don't need to be.</div><div class="" style="font-family: Palatino-Roman; font-size: 14px; 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;"><br class=""></div><div class="" style="font-family: Palatino-Roman; font-size: 14px; 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;">-Joe</div></div></blockquote></div><br class="" 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;"><div class="" 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;">I'm not suggesting they do otherwise. I was saying that using closures for partial application vs scala-style currying has a cost, which makes them less desirable for this (partial) application.</div></div></blockquote><br class=""></div><div>Ultimately, I think we want argument labels to be part of the name, not half-part-of-the-name-half-part-of-the-type like they are today. In the pure-names model, you could plausibly be allowed to name closure variables with compound names:</div><div><br class=""></div><blockquote style="margin: 0 0 0 40px; border: none; padding: 0px;" class=""><div>let partial2(p1:x:) = { projectFunctionToCoordinateSystem(function: mySinFunction, p0: .zero, p1: $0, x: $1) }</div></blockquote><div><br class=""></div><div>-Joe</div></body></html>