[swift-evolution] [Proposal]: Free the '$' Symbol!
Chris Lattner
clattner at apple.com
Sun Jan 3 21:17:39 CST 2016
We need a token to be unambiguously an operator or identifier - we can have different rules for the leading and subsequent characters though.
-Chris
> On Jan 3, 2016, at 6:02 PM, Jacob Bandes-Storch <jtbandes at gmail.com> wrote:
>
> Is it considered infeasible for any characters to be allowed in both identifiers and operators?
>
>> On Sun, Jan 3, 2016 at 1:23 PM, Chris Lattner via swift-evolution <swift-evolution at swift.org> wrote:
>>
>> > On Jan 2, 2016, at 11:53 PM, Brent Royal-Gordon via swift-evolution <swift-evolution at swift.org> wrote:
>> >
>> >> 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
>>
>> Right. That said, our current operator space (particularly the unicode segments covered) is not super well considered. It would be great for someone to take a more systematic pass over them to rationalize things.
>>
>> -Chris
>> _______________________________________________
>> 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/20160103/7a888b1e/attachment.html>
More information about the swift-evolution
mailing list