That makes sense. But what if one or both of the operands were Java objects? e.g. replace the JS native String above with java.lang.String:

js> new java.lang.String("a") == new java.lang.String("a")

If this expression evaluated to true, it wouldn't violate JS equality semantics, since JS values are not involved.

Except they are. These values belong to the JavaScript "object" type:

js> typeof(new java.lang.String("a"))
object
They *have* to be exposed as such, since in JavaScript, every value must belong to one of the JS types, and the *only* types in JS are these: Undefined, Null, Boolean, Number, String, and Object [1].

Ah. Again, this makes sense, but it's unfortunate. I had assumed that Java interoperability in Rhino was a sort of extension to the language. I didn't realize that it had to tie in this way.

Thanks for the info!

Greg

_______________________________________________
dev-tech-js-engine-rhino mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-js-engine-rhino

Reply via email to