Hi teamers,

        I was badly caught out the other day teaching CS1.  We were working with
functions, specifically:

function Max(Left, Right : Integer) return Integer is
begin  --  Max
   if Left > Right then
      return Left;
   else
      return Right;
   end if;
end Max;

        I wanted to use the function as a binary operator, hence:

function "#"(Left, Right : Integer) return Integer is
begin  --  #
   if Left > Right then
      return Left;
   else
      return Right;
   end if;
end "#";

        expecting to be able to use:

        My_Integer_Io.Put(Value1 # Value2);  or
        My_Integer_Io.Put("#"(Value1, Value2);

        My thinking was that, since the function identifier is a string, I should
be able to use any character as an operator.  Of course, it turns out that
I can only overload existing operators, but then:

        My_Integer_Io.Put(Value1 + Value2);  or
        My_Integer_Io.Put("*"(Value1, Value2);

        when the result is a maximum is very misleading.

        Two questions:
1. Is it possible to generate user defined binary operators?
2. If not, then why not?


--------------------------------------------------------------------------
Rick Duley
Edith Cowan University
Perth, Western Australia

tel: +61 (08) 9370 6619
                                                                   /-_|\
fax: +61 (08) 9370 6100                                           /     \
                                                            perth *_.-._/
"The lonliest place in the world                                       v
                          is the loosin' champ's dressin' room!"
                                                             (Jack Dempsey)
"He wasn't an Ada programmer in Perth!" (Rick Duley) J