<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 Oct 4, 2016, at 9:32 AM, Michael Ilseman 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 style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: 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 Oct 4, 2016, at 9:21 AM, 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;">SE-0111 established that Swift's type system would not allow function argument labels to be expressed as part of a function type. As I've been working with curried functions, I'm discovering an unintended consequence of this proposal in that it strips curried functions of their external labels and the resulting calls of their readability.<div class=""><br class=""></div><div class="">```</div><div class=""><div class=""><font face="Menlo" class="">public func projected(</font></div><div class=""><font face="Menlo" class=""> function f: @escaping (CGFloat) -> CGFloat) -></font></div><div class=""><font face="Menlo" class=""> (_ p0: CGPoint, _ p1: CGPoint) -> </font></div><div class=""><font face="Menlo" class=""> (_ percent: CGFloat) -> CGPoint</font></div><div class=""><font face="Menlo" class="">{</font></div></div><div class="">```</div><div class=""><br class=""></div><div class="">Calling the first level of currying still reads acceptably:</div><div class=""><br class=""></div><div class="">```</div><div class=""><font face="Menlo" class="">let projectedFunction = projected(function: fToApply)</font></div><div class="">```</div><div class=""><br class=""></div><div class="">But after that, the enforced label-less arguments mean all further semantics have to stay within the name of the assigned partially applied function symbol and all arguments must be supplied without meaning, which is not in the spirit of API guidelines or under the umbrella of Swiftiness:</div><div class=""><br class=""></div><div class="">```</div><div class=""><font face="Menlo" class="">let fixedFunction = projectedFunction(p0, p1)</font></div><div class=""><font face="Menlo" class="">let value = fixedFunction(0.2)</font></div><div class="">```</div><div class=""><br class=""></div><div class="">There's no way to give either the line segment start and end points or the percent-of-progress arguments any labels. Further, Xcode/QuickHelp does not provide any support for documenting the roles of each curried return type.</div><div class=""><br class=""></div><div class="">Could this be addressed specifically for currying or has the boat sailed forever on this topic?</div><div class=""><br class=""></div></div></div></blockquote><div class=""><br class=""></div><div class="">This could be expressed by allowing local variable names to have compound names when of function type. I would not require it to be expressed this way, but it would be a nice addition. This would look something like the following:</div><div class=""><br class=""></div><div class="">let projectedFunction(from:to:) = projected(function: fToApply)</div><div class="">let scale(by:) = projectedFunction(from: myPoint1, to: myPoint2)</div><div class="">let finalPoint = scale(by: 3.0)</div><div class=""><br class=""></div><div class="">When it comes to local assignment, it makes sense to allow local control over argument labels. For people who don’t care to have their closures be applied with labels, maybe allow current syntax:</div><div class=""><br class=""></div><div class=""><div class="">let projectedFunction = projected(function: fToApply)</div><div class="">let scale = projectedFunction(myPoint1, myPoint2)</div><div class="">let finalPoint = scale(3.0)</div><div class=""><br class=""></div><div class="">I’m not sure if we want to force compound names always (demonstrate arity and explicit label-less-ness), but one could envision a strict enforcement like:</div><div class=""><br class=""></div><div class=""><div class="">let projectedFunction(_:_:) = projected(function: fToApply)</div><div class="">let scale(_:) = projectedFunction(myPoint1, myPoint2)</div><div class="">let finalPoint = scale(3.0)</div></div><div class=""><br class=""></div></div></div></div></blockquote><div><br class=""></div><div>To clarify, I’m not in favor of strict enforcing of this final form, and it would need extreme justification to make that pitch. But, it might be possible to encourage that form in linting tools. And, if there is strong, albeit not extreme, justification, enforce through a warning/fix-it).</div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: 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 class=""><div class=""><br class=""></div><div class="">Probably out of scope for Swift 4 stage 1</div></div><div class=""><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class="">-- E</div><div class=""><br class=""></div></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br class=""></div></blockquote></div><br class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: 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;"><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: 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="">_______________________________________________</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: 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-caps: 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="">swift-evolution mailing list</span><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: 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=""><a href="mailto:swift-evolution@swift.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: 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="">swift-evolution@swift.org</a><br style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: 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=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: 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="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></blockquote></div><br class=""></body></html>