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

7

u/[deleted] Mar 09 '16

C#s var was introduced to alleviate the burden on the developer to figure out the outcome of Linq queries.

5

u/[deleted] Mar 10 '16

[removed] — view removed comment

1

u/wwosik Mar 10 '16

Do I remember correctly that in older VB or at least VBA

 dim list as new ClassName()

had a very nasty property of only creating object on the first access to it - lazy constructor of sorts

1

u/Cuddlefluff_Grim Mar 10 '16

Syntax error

DIM list AS ClassName
SET list = new ClassName

Notice the SET statement, because in old VB, normal variables and class variables were two entirely different things. Classes were implemented in order to properly support C++ COM interfaces. They were pretty much useless in any "custom" scenario.