Friday, August 10, 2018

The VAR horror in Java 10

Why have all the smart people left the Oracle Java Team and the JCP ? To our horror, it seems one of the few BIGGIE new features of Java 10 will be support for VAR. WHY?

I don't know how useful this will be, as I am quite used to seeing int i =0 or String name = "Java", and I liked the type information present in the variable declaration line, but it looks like Java is going the way Scala and Kotlin are and trying to incorporate changes from there.
Also note that the var keyword can only be used for local variables, i.e. variables inside methods or code blocks — you cannot use it for member variable declaration inside the class body.
And, finally, it doesn't make Java a dynamically typed language like Python. Java is still a statically typed language, and once the type is assigned, you cannot change it. For example, var name = "Java" is OK, but then name = 3; is not OK.

VAR is an abomination. It is even doubled abomination in Java because it indicates dynamic typing when it IS NOT. Worse, it is code type OBFUSCATION leading to more bugs.

They've gone full nutters over there. Someone tell me what's happened to the smart people.

No comments:

Post a Comment