r/programming • • Sep 15 '20

Java 15 released!

https://jdk.java.net/15/
214 Upvotes

130 comments sorted by

View all comments

Show parent comments

4

u/vytah Sep 16 '20

My colleagues are still afraid of using var though, so nothing changed really.

I remember when C# got var, some programmers were against it as they didn't want any dynamic typing in their language.

17

u/AndreasTPC Sep 16 '20

They are idiots if that's their reasoning, because type inference is not dynamic typing by any means.

With dynamic typing the type is determined at runtime and can change during execution. In a statically typed language with type inference the type is still determined at compile time and can't change during execution, all the guarantees from the type system are still there. The only thing that changes is how readable the code is.