Order of declaration in top level #12383
yadavan88
started this conversation in
General Discussion
Replies: 1 comment 1 reply
-
This is also a frequent question with the (Scala 2) repl. That is, semantics depends on the underlying implementation or model. I think this is worth nailing down, even if the REPL and compiler must distinguish "newbie" mode from "expert" mode. In this case, Arguably, the compiler could offer a "development" mode, that would be orthogonal to optimizer flags, for example. Possibly sbt could respect development mode (and do a clean build on publish, for example). |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
While I was trying the scala 3 features, found out a behaviour which I thought is interesting or strange. Is this expected behaviour?
`
val i = j + 100
val j = 10
@main def main() =
println("i="+i) // prints 100, but was expecting 110
println("j="+j)
`
I thought it might give forward reference error, but instead it computed by using the default value.
Beta Was this translation helpful? Give feedback.
All reactions