Thank you for the comprehensive explanation. I have new questions now:
Start of the application? If I understand you correctly, you’re implying there is no real late-binding for the abstract val
s. Otherwise, the initialisation should have been postponed to the time when a concrete value is provided further down the inheritance hierarchy. Or, am I missing anything?
Well, it indeed is checked:
scala> trait B3 extends B1 {def v = -10; def f(): Int}
defined trait B3
scala> val b3 = new B3 {def f() = 124000}
java.lang.IllegalArgumentException: requirement failed
at scala.Predef$.require(Predef.scala:212)
at B1$class.$init$(<console>:17)
... 33 elided
Albeit, I would say it should have been checked earlier — making B3
illegal even before its instantiation.
Cheers,
–Hossein