[swift-evolution] [Idea] Custom default names for arguments of closures

Patrick Gili gili.patrick.r at gili-labs.com
Sat Feb 13 15:16:26 CST 2016


Hi Eugene,

I think you'll be able to accomplish this with SE-0021 (https://github.com/apple/swift-evolution/blob/master/proposals/0021-generalized-naming.md <https://github.com/apple/swift-evolution/blob/master/proposals/0021-generalized-naming.md>), which has been accepted for Swift 2.2.

Cheers,
-Patrick

> On Feb 13, 2016, at 3:38 PM, Eugene Gubin via swift-evolution <swift-evolution at swift.org> wrote:
> 
> func executeClosure(closure: Closure) {
> 	// the caller uses external parameter names, nothing changed here 
> 	closure(first: "first", second: 2)
> }
> 
> executeClosure {
> 	// the callee uses custom arguments instead of $0, $1
> 	// also it is possible to override these names here as usual 
> 	print("one \(one) two \(two)")
> }

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


More information about the swift-evolution mailing list