Alright, I know that Scala allwos no aux cons type params. What if I have a class like
class Group[G <: Groupable] (groupees: Buffer[G]) {
//stuff here
}
and what if I want to extend that class, say
class Lizards extends Group [Lizard] (Buffer[Lizard]())
the parent class cons argument here seems unnecessary, so I want to take it down by assuming that if Group
is parametrized with something, that very type should be used in the buffer creation. Is there any way to do that aside from the forbidden typed aux cons?
Seems to work fine for me:
import collection.mutable.Buffer
trait Groupable
class Group[G <: Groupable] (groupees: Buffer[G])
class Lizard extends Groupable
class Lizards extends Group[Lizard] (Buffer()) // type only on superclass
class Lizards extends Group (Buffer[Lizard]()) // type only on argument