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

Félix Cloutier felixcca at yahoo.ca
Sun Jan 3 12:40:00 CST 2016

As I recall it, there is no overlap between operator characters and identifier characters. If it's not in the operator set, it's effectively reserved for identifiers.

I also remember someone from Apple confirming what Brent said but I can't find it at the moment.


> Le 3 janv. 2016 à 03:47:39, Developer via swift-evolution <swift-evolution at swift.org> a écrit :
> 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
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

More information about the swift-evolution mailing list