I wrote a trait for sorting iterables in Scala, and it took almost as long to make a class that I could mix it in with as it took to write the trait. Why was the design decision made to disallow users from writing things like:
new List[Int] with SuperAwesomeTrait[Int]?
Now if I want to do this, I need to do some weird hack like,
class StupidList extends LinearSeq {
val inner = List()
/* reimplement list methods by calling into inner */
}
and then
new StupidList[Int] with SuperAwesomeTrait[Int].
Because if I write
I don’t want my logic broken by a new, unexpected subclass.
I suspect you’re trying to solve a problem using subclassing that would be better solved with implicits.