2 ms·
> Local variable type inference has helped in [...] making Java code more readable. whoever got that idea? if i have to infer the variable type it is _less_ re
by pestatije 3y ago
> Local variable type inference has helped in [...] making Java code more readable.
whoever got that idea? if i have to infer the variable type it is _less_ readable
This idea is the same as saying less comments make code more readable because it reduces verbosity and typing
- theanonymousone 3y agoOf course, but I believe there is here a distinction between two slightly different cases to be made: Inferring the return type of methods (i.e. `var x = MyMethod()`) does indeed reduce readability, I fully agree. This is one of the things I highly dislike in Python, for example. On the other hand, `MyClass x = new MyClass()` does not contain much extra information compared to `var x = new MyClass()`, aside maybe from polymorphism-related information. Does it?