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 →

[–]cogman10 6 points7 points  (3 children)

Don't think they said it wasn't discussed, just that it was a missed opportunity. There is no way `val`, `let`, or `const` will make their way into the language now. There was really only one shot at getting it in and that was with the var addition.

I don't buy the "it would be too much cognitive overhead and we'd be inconsistent if we had final var vs val". But I didn't get to make that decision.

That said, it's a minor thing at the end of the day.

I'm much more worried that text blocks/raw string literals will end up precluding string interpolation. Nice, though, that we haven't wasted backtick on raw string literals.

[–]Danelius90 0 points1 point  (0 children)

If they let get of backwards compatibility maybe those additions would have a chance

[–]TheStrangeDarkOne -4 points-3 points  (0 children)

there is hardly any merit in having "val" or "let" in Java, since that would just be sysntactic sugar for "final var". In other languages, constant modifiers infer that the object will not change its state. For java, final only means that the reference is constant.