4 ms·
> * Multiversal Equality: you get to decide whether it makes any sense to compare an Apple and an Orange using "==" or "!=", as opposed to Java's forced require
by lmm 9y ago
> * Multiversal Equality: you get to decide whether it makes any sense to compare an Apple and an Orange using "==" or "!=", as opposed to Java's forced requirement of allowing you to compare anything with anything. [2]
Unfortunately it's being introduced in a fail-unsafe way that as far as I can see makes it virtually useless. If I see "x == y" in code, I have no way to be confident that this isn't an old-fashioned universal comparison without going into the details of x and y, so I'm no better off than I was without this feature.
- coryfklein 9y agoYea, I'd love a compiler switch that enables the strict mode globally, while adding the leniency on a case-by-case basis instead.
- bad_user 9y agoYou can always switch to usage of Eq and its === operator from Cats or Scalaz.
- eeperson 9y agoIt looks like you can force strict equality everywhere with the flag '-language:strictEquality'. See the dotty documentation for more details: http://dotty.epfl.ch/docs/reference/multiversal-equality.html http://dotty.epfl.ch/docs/reference/multiversal-equality.htm... EDIT just realized you are m50d on reddit and probably saw the exact same comment I got that from.