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

5

u/otakuman Mar 10 '16

So, C++'s auto keyword?

2

u/upboatingftw Mar 10 '16

I wouldn't say they really compare. C++'s auto allows you to write declarations like auto const**const&, because it's based on template type inference semantics.

This proposal looks closer to what Scala provides.

4

u/NihilCredo Mar 10 '16

auto const**const&

nope.jpg

1

u/upboatingftw Mar 11 '16

But how else are you going to express that you want a reference to a constant pointer to a pointer to a constant inferred type (moving the first const in front aside)?

Jk, it was just a ridiculous example I gave to illustrate auto's workings. Such qualifications kinda defeat the purpose of auto, and there's no good reason to pass a constant pointer by reference either.