[swift-evolution] [Proposal] Refining Identifier and Operator Symbology

Jonathan Hull jhull at gbis.com
Thu Oct 20 14:25:04 CDT 2016


Would it be possible to do the following:

• Have 1 group which are always used as identifiers.  This would probably be the identifiers from this proposal.

• Have a 2nd group which are always used as operators (quite a bit larger than the group proposed by this proposal).  At a minimum, the following ascii + set operators + math operators: 
(± ≠ ≤ ≥ ¿ ¡ ™ ¢ ¶ • ° ƒ © √ ∆ ◊ § ≈  ∫ ÷ ¬ ).

• Everything else is in a 3rd group.  These can be used as identifiers unless they have been defined as an operator somewhere within the project, at which point they switch to being only usable as operators.  As long as the 2nd group is large enough, this shouldn’t cause conflict issues too often.  It would prove useful to lots of subdomains (especially mathematicians).


Alternatively, we could just allow anything outside of the 2nd group to be an operator (including letter-like characters) as long as:
1) It is wrapped in parenthesis without spaces (∆) or even (op)
2) It has been declared as an operator
3) It is not a keyword or otherwise taken

Taken to it’s extreme, that might someday even allow anonymous operators.
let (©) = { lhs, rhs in …}
let ans = a (©) b

Thoughts?  Is this possible?

Thanks,
Jon


More information about the swift-evolution mailing list