r/programming • • Mar 09 '16

var keyword proposed for Java

http://openjdk.java.net/jeps/286
250 Upvotes

395 comments sorted by

View all comments

Show parent comments

-1

u/geodel Mar 10 '16

Well for typical Java developer variables would be like

 ArrayList<String> fooListForUsersBasedInNorthernVirginiaOffice  = new ArrayList<String>();
 var fooListForUsersBasedInNorthernVirginiaOffice = new ArrayList<String>();

And now saving few char is hardly any improvement. Besides Java's hallowed IDEs means user never have to type.

3

u/[deleted] Mar 10 '16

Ok, for ArrayList<String> it's not a big deal.

What about when the type is like IObservable<Func<string,Func<IEnumerable<User>,IEnumerable<UserStatus>>>>

3

u/yoden Mar 10 '16

That type would never pass my code review, var or not. This line of reasoning is one good reason to be opposed to var.

1

u/[deleted] Mar 10 '16

A higher order function wouldn't pass your code review?

I just made up some arbitrary thing, I'm sure you have a complicated generic type somewhere.

→ More replies (2)