after I learned that case classes extend Product, I wondered why they do not extend ProductN. E.g., given a code like:
case class Foo(a: Int)
I
Consider this:
case class X(n: Int)
case class Y(x: String, y: Int) extends X(y)
If case classes extended ProductN
, then that would extend both Product1
and Product2
, but the type parameter changes, so there are two different overloads for _1
. This is just one problem -- I bet there are others.
Now, case class inheriting case class has been deprecated, and Martin Odersky is now considering making them inherit ProductN. AFAIK, is has not been done yet, but the obstacle has been removed.