It bemuses me that Java guru Joshua Bloch is still anti operator overloading ("Java Puzzlers" webcast from Javapolis, with Neal Gafter).
So if (a > b)
is apparently more confusing than if (a.compareTo(b) > 0)
?
I totally get that arbitrary overloading isn't very javalike, but allowing specific operators (.compareTo overloads comparison ops, .addTo overloads + etc.) for classes tagged with particular interfaces doesn't seem that much of a mess. Hey ho.
The belief that operator overloading is evil stems largely from abuse by the C++ crowd. However, Ruby has shown me that it can be extremely useful without being the least bit confusing.
Re:
Aristotle on 2005-05-03T16:23:47
OTOH you can also abuse it in Ruby. (And Perl.)
It’s just very much like Java to be sternly patriarchal about things that could potentially be harmful. “No multiple inheritance for you! No operator overloading for you! No inheriting from base type classes for you!” Etc.