BigDecimal doesn't count? (I guess because it's "Big" rather than efficient.)
d = a.add(b.mul(c));
instead of d = a + b * c;
Even COBOL's COMPUTE D = A + B * C.
was clearer than Java's OOP notation.They should retrofit it as follows:
interface Addable<T> {
T add(T other);
}
And then make the + apply to any Addable, which can be defined for the boxed primitives. And so on for the other operators.A java string added to anything results in the toString() method being called. It doesn't matter if the string is before or after the + operator. How do you specify precedence in this new scheme short of an exponentially large `add` method handling all the cases. And each add method has to handle all the variety of cases.
interface Addable<RHS, Result> {
Result add(RHS other);
}
The problem is hardly new though. Groovy is very Java-like and has operator overloading: http://groovy-lang.org/operators.html#Operator-Overloading