[swift-evolution] Pitch: Compound name `foo(:)` for nullary functions

Matthew Johnson matthew at anandabits.com
Fri Feb 24 13:55:31 CST 2017


> On Feb 23, 2017, at 12:52 PM, Anton Zhilin via swift-evolution <swift-evolution at swift.org> wrote:
> 
> +1 to foo(:) version.
> I can easily see placeholder arguments as a sugary syntax for closures:
> 
This shorthand has been explicitly rejected several times in favor of the $ argument shorthand.

> func bar(_ x: Int, _ y: Double)
> let f = bar(_, 42)   // the same as:
> let f = { (x: Int) in bar(x, 42) }
> Now, let’s view a single-parameter version:
> 
> func foo(_ x: Int)
> let f = foo(_)   // the same as:
> let f = { (x: Int) in foo(x) }
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170224/40f59b29/attachment.html>


More information about the swift-evolution mailing list