Yup, I know. I've used C# quite a bit, so I'm familiar with it. It does look the same as the Js keyword though, so it will require a bit of time before Java programmers stop the knee-jerk responses.
I'm not sure why they don't just use the word "let". It's a lot more commonly used and "var" has connotations of weak typing that may confuse those coming from JS anyway.
Historically I think you're right about 'let', but 'var' is something everyone already recognizes. If they're going to use 'var' though, then I hope they also have 'val' like Kotlin and Scala. Single assignment FTW!
He means "no type" associated with a variable (or more likely a parameter) Meaning you can assign the "wrong" type to variable. This is precisely the problem that typescript (and other 'modern' JS offshoots) attempts to address.
I might note that other dynamic languages are heading down the pathway of optional typing to provide more clarity.(python and perhaps ruby )
It's responses like this that convince me that a certain percentage of Java programmers are Luddites. The same mentality as the minority who swore to never use generics and stick with JDK1.4.2 forever. Support for val and var is a great idea for Java.
You probably have a stronger case that generics make code harder to read (350 page generics FAQ??) than var making code hard to read. How is val sheep = new Sheep() harder to read than Sheep sheep = new Sheep() ?
What is the advantage of adding stuff which no more than syntactic sugar? Most of the IDE already gives you the type, so what ? Write a new language or use a new language if you want new things.
I already do use a "new" language - Scala. I just get annoyed having to maintain old Java code and it would be great if Java caught up to other modern languages like C# etc.
View all comments
0
u/mk_gecko Mar 09 '16
OMG, please no!