Looking at the source code for immutable.List, I see this
final case class ::[B](override val head: B,
private[scala] var tl: List[B]) extends List[B] {
override def tail : List[B] = tl
override def isEmpty: Boolean = false
}
My understanding of case classes is that this signature is invalid because:
- constructor parameters are not all public
- constructor parameters are not all vals
Can somebody explain to me how this is working?
vars.