Operator overloading for non-value objects

Domenic Denicola domenic at domenicdenicola.com
Tue Jan 14 18:44:31 PST 2014

From: es-discuss [mailto:es-discuss-bounces at mozilla.org] On Behalf Of Brendan Eich

> js> 0L == "0"
> typein:2:0 TypeError: no operator function found for ==

Hmm, upon seeing this in action, I'm not sure how I feel about `==` throwing. It doesn't normally do that (modulo bad custom `valueOf`/`toString` methods), so I think there will be a lot of code that assumes when it `==`s two values it doesn't need to wrap that expression in `try`/`catch`.

`do { try { x == y } catch { false } }`, the new `x == y`?

More information about the es-discuss mailing list