This page is no longer maintained — Please continue to the home page at www.scala-lang.org

case class inheritance

No replies
extempore
Joined: 2008-12-17,
User offline. Last seen 35 weeks 3 days ago.

Presenting this in a potentially biased light in order to push us toward
a decision one way or the other:

Would anyone like to champion NOT deprecating case class inheritance?
This refers to case classes extending case classes, directly or
indirectly, but does not otherwise pose restrictions.

In the absence of such a champion, I would like to advocate their
deprecation. (Of course if an anti-deprecation champion emerges I may
have to flee like brave, brave sir robin.)

Advantages as expressed earlier by drmaciver:

- It doesn't appear to be that useful
- The current implementation is significantly buggy
- It has very strange interaction with equality

Additional advantage which I wish I'd remembered to mention up front:

- It allows case classes to inherit from ProductN again

Implicit endorsements from others, disregard if you don't agree as
they're not central to the argument, I'm just throwing them in here:

http://gbracha.blogspot.com/2009/03/subsuming-packages-and-other-stories...
"Do not try and combine ADTs with inheritance (because then you lose
subsumption)."

http://www.informit.com/content/images/020163371x/items/item33.html
"Make non-leaf classes abstract"

The pattern matcher has serious correctness issues which are unlikely to
be addressed in time for 2.8. They will be addressed, I guarantee (it's
just a matter of who gets to it first - drmaciver, me, or some as yet
unidentified party) but if this task can be simplified by dropping
something underspecified and of uncertain value, then it ought to be.

Copyright © 2012 École Polytechnique Fédérale de Lausanne (EPFL), Lausanne, Switzerland