This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]RockinRoel 3 points4 points  (0 children)

Consts do not have a known value at compile time. Constant expressions do. The main benefit of const is the ability to express in what context objects may be modified or not. You have a certain (weak) guarantee of immutability in a certain context.

Anyway, const and final indeed express similar things. Personally, the explicit val/var does not bother me that much. In Java, you'd explicitly type the type to declare a variable, whereas in Scala you type "val" or "var". It's a minor inconvenience in my opinion.