4 ms·
It's subtle, but you're both saying different things. What happens with Kotlin cannot happen with Scala `val`s. Note in Kotlin it may return something entirely
by the_af 9y ago
It's subtle, but you're both saying different things. What happens with Kotlin cannot happen with Scala `val`s. Note in Kotlin it may return something entirely different, not just the same reference to a mutable object. It seems that in Kotlin a `val` may get evaluated every time it's called, whereas in Scala it can only be evaluated once.
In Scala it cannot happen that you call a `val` twice and it returns a different object.