[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Java operator overloading



Hi Maya,

Maya Gokhale wrote:
It is somewhat related, but not completely. We want to do operator
overloading as in C++, so that, for example, an infix "a + b" will invoke
a particular method in "a"'s class that understands "+" given an argument of "b"'s class.

So, how will you deal with "precedence & associativity overloading" which should go along with operator overloading? I know C++ simply does not redefine precedence and associativity of overloaded operators, but this seems wrong to me, as associativity and precedence are a part of the definition of an operator. In other words, if you are ready to add operator overloading, why not go all the way and fully implement it?

Etienne

--
Etienne M. Gagnon, Ph.D.             http://www.info.uqam.ca/~egagnon/
SableVM:                                       http://www.sablevm.org/
SableCC:                                       http://www.sablecc.org/