[swift-evolution] Proposal: Make $0 always refer to a closure’s first argument

Thorsten Seitz tseitz42 at icloud.com
Wed Jan 20 14:18:50 CST 2016

That’s a good idea!


PS: we might also use $0 for the tuple and $1, … for the args, like regex syntax does ($0 = whole match, $1 = first group etc.). This would not work so well with the general zero-based index behavior of Swift.

> Am 20.01.2016 um 20:05 schrieb David Waite via swift-evolution <swift-evolution at swift.org>:
> Since $<identifier> is reserved for the repl/debugger, $<operator character> is troublesome for parsing, and $<reserved character> could result in odd special cases or limitations in language evolution - how about just $ ?
> e.g., $0 is semantically a shortcut for $.0
> -DW

More information about the swift-evolution mailing list