Thu, 27 May 1999 15:27:28 -0400
At 10:35 AM 5/27/1999 -0400, Ben Brosgol wrote:
>Interestingly, and as Robert may recall, Jean Ichbiah once proposed that Ada
>allow the international currency symbol as a unary operator symbol that was
>available for users to overload. JDI's idea was that it could serve as a
>lightweight notation for type conversions for user-defined types (typically
>unary "+" is used for that purpose). For various reasons his proposal was
>not accepted, which is probably a good thing given Robert's news that this
>symbol is being evicted from Latin-1 to make room for the euro.
Two comments. First, I belive the current status is that 8859/1 has
been updated to include the Euro symbol, but the fixes to 10646 and ASCII
are still in the approval pipeline. I expect that patches and updates for
character set software is already reflecting the change, because the old
international currency symbol was never much used.
Second, it would have been fun if it had been available. In fact maybe
in the next Ada standard we can revisit this proposal with some other
characters. Using Unicode (or UTC) we could have loads of additional
operator symbols. Even staying within Latin-1 provides lots of interesting
Left and Right Angle Quotations for labels.
Not sign as an alternative to "not".
Degree sign as a postfix operator.
Superscript two and three as (possibly static) aliases for
"**2" and "**3".
Division and Multiplication signs as binary operators with the obvious
default meanings. (Note: it would be nice to make them overloadable
separate from the existing multiply and divide operations for cases where
there are inner and outer products, and for different meanings of division
in modulo arithmetic.)
Or you could use Middle Dot for dot product, and multiplication sign
for cross product. ;-)
What about the Plus and Minus sign? Did you ever want to write:
if X in Y +/- Delta then...
in place of
if X in Y + Delta..Y - Delta then...
especially when Delta is a function or expression you would like to
evaluate once. (Notice that the right sequence for evaluating this is not
easy for a non-peephole optimizer to see, especially if Delta is really a
temp used because you want it evaluated once. Sometimes you can rewrite as:
if X - Y in -Delta..Delta then...
but even then the compiler is unlikely to figure out the right code on
some hardware. (The nice choice on a machine with an inline abs operator is
branch greater zero (around true part)
Only one branch, and a minimum number of loads. (I'm assuming that
there is no inline bounds checking needed at run-time...)
Robert I. Eachus
function Message (Text: in Clever_Ideas) return Better_Ideas is...