[swift-evolution] [Proposal]: Free the '$' Symbol!

Developer devteam.codafi at gmail.com
Sun Jan 3 02:47:39 CST 2016

Well, that's just it.  $ is a perfectly valid character in identifiers everywhere but in the grammar for operators for some reason.  It isn't reserved, it just isn't there.

~Robert Widmann

2016/01/03 0:53、Brent Royal-Gordon <brent at architechies.com> のメッセージ:

>> Swift currently does not allow operators to use $ - I assume because the grammar reserves it in one place: `implicit-parameter-name`.  I don't see why an entire class of identifiers has been eliminated, so I propose $ instead be reclassified as an `operator-character` so it can be used mixed in with other such characters, but prevents the introduction of `$Identifier`-style declarations that might conflict with implicit parameters.
> I believe the reason you don't see any other $ variables is that they're reserved for the debugger and REPL.
>    brent at Brents-MacBook-Pro ~/D/Code> swift
>    Welcome to Apple Swift version 2.1.1 (swiftlang-700.1.101.15 clang-700.1.81). Type :help for assistance.
>      1> "foo"
>    $R0: String = "foo"
>      2> print($R0)
>    foo
> -- 
> Brent Royal-Gordon
> Architechies

More information about the swift-evolution mailing list