-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I'll get a few things out of the way: I don't think mutable case
classes (or mutable classes period) are necessarily a good idea. I'm
very aware of all the immutable sequences in the standard lib. For
reasons that aren't relevant or interesting, an Array is most
appropriate in my code. I know that using mutable objects as hash
keys is a bad idea. I know that ScalaRunTime._hashCode and
MurmurHash3.productHash are implemented in terms of objects' hashCode
methods.
Now that that's over with, I'm not sure you're right about case
classes being immutable by definition. Here's me making a mutable one:
scala> case class C(var x: Int)
defined class C
scala> val c = C(123)
c: C = C(123)
scala> c.x = 42
c.x: Int = 42
scala> c
res0: C = C(42)
Whether or not one *should* make a mutable case class, it appears that
one can. With this in mind, is it right to have different equality
semantics for
case class A(var x: Int) //by value
and
case class B(stuff: Array[Byte]) //by reference
because the types of the fields in A and B are different? Would it
break much existing code if case classes compared by value in all cases?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
iEYEARECAAYFAlKeddoACgkQ0GFaTS4nYxsB8QCgxa3K+fC89t5wsNQDyQZTNffi
ORYAoK3KKDEvncuD8WQTvrEF8ITuqXkQ
=mzw1
-----END PGP SIGNATURE-----