1 Mar 2005 04:18
Re: Support the math power operator **
On Feb 28, 2005, at 2:37, Alan Green wrote:
> So, what kinds of things need to change before 1.0 is released?
1. Reserve ("for future use") a largish set of operator spellings, a la
Borneo.
It will be a set of regular expressions. I can propose such a set.
The actual 2.0 set need not use the whole reserved space.
2. Reserve the dollar '$' character for future use (for name mangling
in VM-level names).
3. (Optional.) Specify a mangling for unicode strings (including
operator spellings)
that (a) uniquely encodes all unicode strings into valid VM-level
method names,
and (b) maps valid dollar-free Java method names to themselves. Use
this mangling
even in 1.0 for representing operator methods at the VM level.
4. (Optional.) Specify direct rules for operator overloading that use
the operator spellings
themselves instead of English words and phrases, in Groovy source code:
- def leftShift(int y) { this.multiply(1<<y) }
+ def '<<'(int y) { this.'*'(1<<y) }
or (targeted exclusively to operators, and less flexible and general
IMO)
+ def op<<(int y) { this.op*(1<<y) }
At the VM level, a name like '<<' or '*' would be spelled something
like '$3C$3C' or '$2A'.
(Continue reading)
RSS Feed