The code snippet:
object WTF extends App {
test
val mymap = Map("Alice" -> 1, "Bob" -> 2, "Charlie" -> 3, "Dave" -> 4)
println("outter mymap="+mymap)
def test { println("inner mymap="+mymap) }
}
produces the following output:
inner mymap=null
outter mymap=Map(Alice -> 1, Bob -> 2, Charlie -> 3, Dave -> 4)
Why is inner printed before outter?
Why is test printing a null mymap?
Is DelayedInit broken on 2.9.2 and is there a way to get inner mymap initialized beside removing "extends App" and writing my own main method?