Just checked with Java keyword usability as variable names.
If I do
int int = 5;
it errors with
[javac] file.java:67: error: not a statement
[javac] int int = 5;
[javac] ^
[javac] file.java:67: error: ';' expected
[javac] int int = 5;
[javac] ^
[javac] file.java:67: error: not a statement
[javac] int int = 5;
[javac] ^
[javac] file.java:67: error: ';' expected
[javac] int int = 5;
If it were a reserved keyword then it would certainly be a problem, but the proposal suggests incorporating "var"/"val"/etc as reserved type names (I.e., not keywords) specifically for backward-compatibility. This would only break pre-implementation packages using the types "var"/"val"/etc, which (as they mention) break Java conventions for type names anyway (Pascal case).
Although frankly primitives as keywords and "var" as just a reserved type doesn't seem quite fair..
3
u/gbear605 Mar 10 '16
Just checked with Java keyword usability as variable names.
If I do
it errors with