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

Kevin Ballard kevin at sb.org
Sun Jan 3 20:17:45 CST 2016


On Sun, Jan 3, 2016, at 12:55 PM, Michel Fortin via swift-evolution wrote:
> Le 3 janv. 2016 à 13:40, Félix Cloutier via swift-evolution <swift-evolution at swift.org> a écrit :
> > 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.
> 
> It's funny that ¢, £, and ¥ are operator characters but not any other currency symbol.

Blame Unicode. $, ¢, £, and ¥ are the only Currency Symbols that have the Pattern_Syntax property, and since Swift explicitly reserves $ for identifiers that leaves just ¢, £, and ¥ for operators. Although you can in fact use ¤ if you want, which is the symbol that denotes an unspecified currency sign.

I suppose Swift could explicitly include the Currency_Symbol general category in the list of operators, but it seems odd to say that things like ฿, ₦, or ₭ should be operators when they look like letters. It would actually make more sense for Swift to explicitly reserve Currency_Symbol for identifiers, which would remove ¢, £, and ¥ from the operator list (but that would be a bit odd because Pattern_Syntax characters make sense as operators, with $ being the single special case that I'm aware of).

-Kevin Ballard


More information about the swift-evolution mailing list