I don't know how useful this will be, as I am quite used to seeingint i =0
orString 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 thenname = 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