Earlier quoted context omitted.
I'd suggest that means your `getAddress()` name could be improved to convey the necessary information.
`getAddressWhichIsOfTypeString()`? `str_GetAddress()`? `GetAddress_STR()`?
Representing the Impractical and Impossible with JDK 10 “var”
31–40 of 131 posts
Re: Representing the Impractical and Impossible with JDK 10 “var”
#32"let" is more elegant IMO.
Re: Representing the Impractical and Impossible with JDK 10 “var”
#33I'm very disappointed that they didn't make `val` keyword. Very simple change but code becomes significantly more readable and a lot of bugs will be compile errors.
Re: Representing the Impractical and Impossible with JDK 10 “var”
#34While I submitted this, I would like to voice my opinion that I am against "var" in Java. People may ask, "Why should I have to enter in the type if the compiler can infer it for me?" My answer is twofold: 1) You or some other maintainer will need to know what that type is later when reading the code. Of course, "var" is meaningless, requiring you to dig back one or more steps to determine the actual type. 2) You don…
People said the same thing about auto in C++. Few years later and everyone I know (and codes C++) loves it and uses it all the time. Its a great addition and like lambas will certainly improve how we write Java
Re: Representing the Impractical and Impossible with JDK 10 “var”
#35Re: Representing the Impractical and Impossible with JDK 10 “var”
#36I'm very disappointed that they didn't make `val` keyword. Very simple change but code becomes significantly more readable and a lot of bugs will be compile errors.
How so?
val x = 1
var y = 2
x = 3 // compile error
y = 4 // ok
It makes it easier to read code since you don't have to keep track of changes in your head.Re: Representing the Impractical and Impossible with JDK 10 “var”
#37"let" is more elegant IMO.
The usual variable declaration syntax is ; it's not a stretch to imagine the type as 'var', a catchall type. But 'let'? Let is a verb; it should be in a place where functions, not types, go. It makes sense in "let x in {}" type expressions, and it kinda makes sense in Lisp, but I don't see any argument for it in a C-like language.
Re: Representing the Impractical and Impossible with JDK 10 “var”
#38Re: Representing the Impractical and Impossible with JDK 10 “var”
#39While I submitted this, I would like to voice my opinion that I am against "var" in Java. People may ask, "Why should I have to enter in the type if the compiler can infer it for me?" My answer is twofold: 1) You or some other maintainer will need to know what that type is later when reading the code. Of course, "var" is meaningless, requiring you to dig back one or more steps to determine the actual type. 2) You don…
If you your method is too large to fit on the screen, the method is probably too long.
But what competent IDE doesn't allow you to just hover over the variable to the know the type?
Re: Representing the Impractical and Impossible with JDK 10 “var”
#40While I submitted this, I would like to voice my opinion that I am against "var" in Java. People may ask, "Why should I have to enter in the type if the compiler can infer it for me?" My answer is twofold: 1) You or some other maintainer will need to know what that type is later when reading the code. Of course, "var" is meaningless, requiring you to dig back one or more steps to determine the actual type. 2) You don…