Overriding the == operator, like in Java/Lua/Python/whatever.

Caitlin Potter caitpotter88 at gmail.com
Sat Jan 3 18:08:38 PST 2015


Unfortunately, there's no "real" way to do this as of yet, short of abusing ToPrimitive in certain cases, far from ideal.

I'm sure someone must have proposed it at some point, but perhaps not. In the mean time, it might be a nice feature of a compile-to-js language like coffeescript or typescript to experiment with

> On Jan 3, 2015, at 8:52 PM, Soni L. <fakedme+es at gmail.com> wrote:
> 
> I've been looking and looking and looking and I couldn't find a way to override == to make 2 different instances of MyPoint compare == if they have the same coordinates. (I guess this also applies to String objects and stuff but I haven't tested that)
> 
> So how do I do this?
> 
> (PS: yes, I know, Java has an .equals method, not overridable ==, but it's basically the same thing)
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150103/5b64f217/attachment.html>


More information about the es-discuss mailing list