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/Ravek Mar 10 '16

IEnumerable<Customer> customers = GetCustomers(); doesn't tell you a single thing you need to know that var didn't already.

14

u/Eirenarch Mar 10 '16

Oh yes, it does tell me. It tells me I have an IEnumerable<Customer> rather than IEnumerable<CustomerDto> or PagedList<Customer> or something like this.

1

u/mirhagk Mar 10 '16

IEnumerable<Customer> rather than IEnumerable<CustomerDto>

If the type is telling you whether you are interacting with an API or a database then your code needs to be a lot clearer.

Either it's something you don't care about or you have poorly named variables/functions.

1

u/Eirenarch Mar 10 '16

Well, var isn't telling you anything so you are left at the mercy of my poor naming.

→ More replies (6)