Subj : Re: Math / Operator Overloading To : Christopher Mason From : Igor Bukanov Date : Tue Apr 01 2003 09:59 pm Christopher Mason wrote: > 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? JavaScript does not support operator overloading and Rhino does not have any infrastructure to make it work. In particular, semantics of +, - etc. is hardcoded. I think you may try to look at Jython (Java implementation for Python) or wait when in some (distant) future JavaScript 2.0 and its Java implementation will materialize. Regards, Igor .