Mark Lewis
Sep 5, 2022

--

I will second the opinion that has already been expressed that the biggest problem with var is that it is mutable and Java should have followed Scala's lead further and included val.

Anyone who has used languages like Scala that do a lot of type inference with significant static type checkings will know that there is a huge benefit to this type of type inference: refactoring. Refactoring types in languages without type inference (and static type checking) is a huge pain. As a result, developers are more likely to avoid making those types of changes, even when they would improve the quality of the code.

--

--

Mark Lewis
Mark Lewis

Written by Mark Lewis

Computer Science Professor, Planetary Rings Simulator, Scala Zealot

No responses yet