<div dir="ltr">+1<br><br>I've encountered this issue myself on several occasions, and I think you'd always be able to create a function signature that reads like a proper sentence if this is implemented.</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Feb 22, 2017 at 9:24 PM, Patrick Pijnappel 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="ltr"><div>I'd like to discuss allowing a trailing 'argument label' without an actual argument:</div><div><br></div><div><font face="monospace, monospace">func adding(_ other: Self, reportingOverflow) -> … // Actual case in SE-104 where this came up</font><br></div><div><font face="monospace, monospace">func tableView(_ tableView: UITableView, numberOfSections) -> Int // Referenced as tableView(_:numberOfSections)</font></div><div><br></div><div>As illustrated above, the way we reference functions extends very naturally to include these.<br></div><div><br></div><div>This would be very useful for several cases:</div><div>• Delegate methods, which currently all start with the same prefix, except for some odd cases that really actually just needed a trailing argument label.</div><div>• Cases where the function is a more specialized version of one with the same name, but can't use a flag because the return type is different (e.g. reportingOverflow), or the extra flag check is just undesirable. The standard library now uses some workarounds to achieve this (e.g. having a trailing argument of type void).</div><div>• Function names that just work more naturally with some additional words after the last argument. If we allow trailing argument labels, you can form any sentence, rounding out the syntax. </div><div><br></div><div>Overall, I think this could be the final missing piece to complete Swift's functions-as-sentences approach.</div></div>
<br>______________________________<wbr>_________________<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/<wbr>mailman/listinfo/swift-<wbr>evolution</a><br>
<br></blockquote></div><br></div>