Operator overloading for non-value objects

Anne van Kesteren annevk at annevk.nl
Mon Jan 13 07:59:28 PST 2014


On Mon, Jan 13, 2014 at 3:40 PM, Brendan Eich <brendan at mozilla.com> wrote:
> We want to keep the relatively few invariants in the language that we have.
> Why is it so important to have == for (mutable) URLs?

The alternative is rather ugly. You don't want to sometimes write ==
(value objects) and sometimes write .equals() (non-value objects,
method name won't always be the same, e.g. we have isEqualNode()
already).

I guess for now we should just go with url.equals(url2) then and see
where that takes us.

(Alex feels more strongly about this than I do.)


-- 
http://annevankesteren.nl/


More information about the es-discuss mailing list