language design - Why are all of the base immutable collections final or sealed in scala? -
language design - Why are all of the base immutable collections final or sealed in scala? -
i wrote trait sorting iterables in scala, , took long create class mix in took write trait. why design decision made disallow users writing things like:
new list[int] superawesometrait[int]?
now if want this, need weird hack like,
class stupidlist extends linearseq { val inner = list() /* reimplement list methods calling inner */ }
and then
new stupidlist[int] superawesometrait[int].
because if write
somelist match { case cons(head, tail) => whatever case nil => somethingelse }
i don't want logic broken new, unexpected subclass.
i suspect you're trying solve problem using subclassing improve solved implicits.
scala language-design
Comments
Post a Comment