Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> * 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.



It 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.htm...

EDIT just realized you are m50d on reddit and probably saw the exact same comment I got that from.


Yea, I'd love a compiler switch that enables the strict mode globally, while adding the leniency on a case-by-case basis instead.


You can always switch to usage of Eq and its === operator from Cats or Scalaz.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: