Actually, if "val f" *was* a field initialization statement, it would
be valid. For instance, it would be valid on the body of "Main",
instead of the body of method "main".
It's a local val, and forward references to local vals are not allowed.
Technically, since they are allocated on the stack, instead of being
relative pointers into the memory allocated to object "this" on the
heap, they may not exist until the time they are first initialized. A
field, on the other hand, has its memory allocated from the outset,
and even zeroed by JVM.
--
Daniel C. Sobral
I travel to the future all the time.