[swift-evolution] [Proposal] Refining Identifier and Operator Symbology
Martin Waitz
tali at admingilde.org
Fri Oct 21 06:38:43 CDT 2016
Hello,
Am 2016-10-20 17:14, schrieb Jonathan S. Shapiro via swift-evolution:
> If we actually wanted to solve the noun/verb issue, we need to
> acknowledge that being a noun (verb) is orthogonal to being a
> conventional identifier (math symbol identifier).
I really like the idea of separating tokenization of names and
detection of 'normal' identifiers vs. operators.
> Unfortunately every change comes at a cost, and the cost of this one
> is that we would once again have to be thoughtful about white space.
Maybe we can minimize the change and confusion by using several groups
of characters
which each can form a valid identifier token.
E.g.:
* one group based on the tokenization of identifiers (as specified in
this proposal)
* one group based on ASCII operator symbols (again as specified in the
proposal)
* all other characters stand for themselves and directly name an
identifier
That is: either use letters and numbers to build a name, or use ASCII
symbols to build a name.
All other characters can also be used, but they don't combine with each
other and would have
to be descriptive enough to directly name an identifier.
For all the mathematical symbols which were discussed here, this should
not be a problem.
They already have a meaning of their own and do not have to be combined
with each other.
This way, no explicit white space would be required between identifiers
and operators,
assuming that the operators either use ASCII-only operator characters or
some Unicode
operator symbol.
We could keep easy tokenization and still allow almost all use-cases of
operators which
were presented here.
--
Martin
More information about the swift-evolution
mailing list