Subj : Math / Operator Overloading To : netscape.public.mozilla.jseng From : Christopher Mason Date : Tue Apr 01 2003 12:08 pm I have an application which uses Rhino to interpret bits of javascript code that perform calculations. This is all fine and good and it works. The problem is that numbers in the calculations are stored as BigDecimals for precision reasons (they involve financial transactions that often hinge on fractions of pennies). This means I have to write ugly javascript like a.plus(b.multiply(c)) instead of nice, pretty javascript like a + b * c Java somewhat complicates this by not having any numerical operations in the Number class. This is bad because it locks in the choice of BigDecimal for all time, because no "builtin" numerical types support the first statement above except for BigDecimal/BigInteger. I'm wondering how hard it would be for me to extend Rhino to implement a kind of operator overloading such that javascript statements like a + b * c might be translated into sets of /java/ calls to BigDecimal equivalent to a.plus(b.multiply(c)) Is this even worth trying to pursue or will it be impossibly difficult? Can someone point me at source code files where math is implemented in Rhino? Am I nuts? Any other ideas? -c .