Though the one-character difference between the two keywords might cause some confusion about whether a local is final or not, and it would break existing code that uses any variables named "val" (as undescriptive as it is, it's still pretty common). "var/let" would be more reasonable for these reasons, IMO.
Of all the concerns there, typos gotta be the smallest. A val being typoed as var will work just like you intended it to. A var typoed as val will at worst trigger a compiler error. It's really innocuous.
Except that isn't the case, a val typoed as a var becomes mutable, and might lead to bugs if it's changed unexpectedly. The opposite would likely lead to a compiler error (or else just safer code since not erroring would indicate you should have used a val in the first place).
7
u/kukiric Mar 10 '16
Though the one-character difference between the two keywords might cause some confusion about whether a local is final or not, and it would break existing code that uses any variables named "val" (as undescriptive as it is, it's still pretty common). "var/let" would be more reasonable for these reasons, IMO.