Before even getting to F-bounded Polymorphism there is construction that underpin it that i already have a hard time to understand.
trait Container[A] trait Contained extends Container[Contained]
That construction which seem to be a trivial object oriented thing to do as it also exist in java, is already slightly puzzling me.
The issue is that when i see this
trait Contained extends Container[Contained] it feels like an infinite type recursion to me.
When we define the type List even tho we have
Cons[A](a:A, tail:List[A]), we also have
case object Nil. So the recursion can end with Nil.
But here, i don’t understand how we are not in an infinite recursion ? And why it works.
Can someone care to un-confused me about it ? Or if there is any documentation, blog, or whatever can explain how this works, or maybe is implemented.