[swift-evolution] [Review] SE-0144: Allow Single Dollar Sign as a Valid Identifier
jay at abbott.me.uk
Tue Oct 18 09:20:24 CDT 2016
> Now for the elephant in the room: '$' is a currency symbol. As such it
> should be handled like any other currency symbol. Thinking otherwise would
> be very culturally offensive.
The fact that it's a currency symbol is totally irrelevant.
It's s symbol. Here are some others:
! & * ( . -
You wouldn't want to allow an identifier to start with any of those
symbols, for obvious reasons.
Programming languages need to reserve some characters and words for special
meanings. In this case: Yes $0, $1, etc. was probably influenced from other
languages; yes $ was probably used in those languages because it was a
convenient available character in the ASCII set, and therefore easy to type
on standard US and other English keyboards (where those languages were
developed and primarily used). This is simple history/legacy, and nothing
to do with the fact it is a currency symbol or any other reason that might
cause offense to anyone.
Unfortunately I think you have misunderstood this proposal. It is to allow
$ as a single-character identifier, even though it is reserved and not
allowed as an identifier-head.
If you think $ should be allowed as the first character of any identifier
(including the single $), then that would be a different proposal which
should cover all the other effects properly.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution