[swift-evolution] [swift-evolution-announce] [Review] Naming Functions with Argument Labels
clattner at apple.com
Thu Jan 14 10:44:44 CST 2016
> On Jan 14, 2016, at 12:14 AM, Brent Royal-Gordon via swift-evolution <swift-evolution at swift.org> wrote:
> If there is even the slightest chance that a future version of Swift will ever add placeholder-based currying like `foo(1, bar: _)`, I strongly favor using an underscore-based syntax for this feature now. A placeholder-based currying syntax is a strict superset of this proposal's capabilities, so there's no reason to end up supporting three syntaxes; we can introduce the most sorely needed subset first and then make it more powerful later.
> If there is absolutely no chance that placeholder-based currying will be added, even in Swift 4 or later, then I am in favor of this proposal.
I don't know if we would ever introduce placeholder based currying, but if we did, u would be pretty strongly against using _ as the placeholder (despite the precedence in other languages), and would rather use a different sigil.
_ in swift currently means "discard" of a value in a pattern, or the closely related "missing" for a parameter name. Expanding that to mean "unspecified value to be provided later" seems like it would dilute this meaning. Basically, it would cause the confusion you are concerned about, independently of this feature proposal.
More information about the swift-evolution