[swift-evolution] superscripts, subscripts, etc.
clattner at nondot.org
Tue Oct 3 01:02:17 CDT 2017
> On Oct 2, 2017, at 10:56 PM, John Payne via swift-evolution <swift-evolution at swift.org> wrote:
> Chris Lattner wrote:
>> Just FWIW, IMO, these make sense as operators specifically because they are commonly used by math people as operations that transform the thing they are attached to. Superscript 2 is a function that squares its operand. That said, perhaps there are other uses that I’m not aware of which get in the way of the utilitarian interpretation.
> But there are SO MANY uses for superscripts, subscripts, and other such annotations, and they are all context specific, just in math, without getting into chemistry, physics, statistics, and so forth.
> They’re really more like methods on the object to which they’re attached, or the combination of a method and an argument.
> Wouldn’t classing them as identifiers lend itself better to this?
No, making them an operator is better for this usecase.
x² to parse as “superscript2(x)” - not as an identifier “xsuperscript2” which is distinct from x.
More information about the swift-evolution