I’m facing a design of this form:
trait A[T]:
def f: B
trait B:
def g(x: T): Seq[T] = Seq.fill(m)(x)
def n: Int
def m: Int
abstract class AB:
def n: Int
def m: Int = n + 1
object O extends A[String]:
def f: B =
new AB with B:
def n: Int = 1
Note how AB defines its own abstract method n and is then mixed in with B. Instead, I’d like AB to extend trait B and simply use n. This doesn’t work:
abstract class AB extends A[?]#B
Is there a way?