A mentoree was looking at a
hashCode implementation yesterday asked what
.## was. As I remember, it’s just an alias for
.hashCode that’s been around since the early days.
Given Scala 3’s design goals of simplicity and consistency, should we also deprecate
.## in favour of just normal
Hey @japgolly it’s actually not an alias for hashCode, since it handles null values (null.## is 0)
It also handles cooperative equality, so that
5.## == 5.0.##, which is important because
5 == 5.0 in Scala.
Oh ok, interesting. Thank you both, I didn’t know that.
Isn’t it there to work on AnyVal as well as AnyRef, as opposed to .hashCode which is only defined on java.lang.Object a.k.a. AnyRef?