[said Tucker to Rick]
> > 1. Is it possible to generate user defined binary operators?
> > 2. If not, then why not?
> Presumably if you overload "+" or "*" you would do so only when you
> are defining an operation that has a lot in common with "+" or "*"
> respectively, and you like the "precedence" implied. However, someone
> reading code scattered with the use of a "#" operator would have
> no way of "intuiting" what it means, nor what is its precedence.
Readability is an important issue here, and implementation is another.
Allowing arbitrary operator symbols would require the writer to
specify, somehow, what the precedence of the new operator was. This
would, in turn, require some new syntax to specify it, and would
also require compilers to support arbitrarily large and complex
The next question would be "well, then, why not ternary operators
like the ? : thing in C?", etc. etc. That would result in a very
different Ada! Think of the syntax rules if each of us could
specify our own operators of arbitrary rank and precedence.
Nice thought (and has made for interesting research), but Ada
compilers are quite complex enough already.:-)
> The number of keystrokes saved by writing "Value1 # Value2" versus writing
> "Max(Value1, Value2)" was not felt to pay off in the long run,
> given that code is read much more frequently than it is written.
> At least that's the official rationale...
To put it a bit differently, operator overloading lets you add
semantic content to the language without changing the syntax.
Ada is extensible, but not _that_ extensible.