r/java • • Mar 09 '16

var keyword proposed for Java

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

312 comments sorted by

View all comments

Show parent comments

5

u/Xenasis Mar 10 '16

This isn't changing Java to be untyped or weakly typed at all. This won't change how Java's type system works whatsoever.

I'm a massive fan of strongly typed languages like OCaml, Agda and Haskell, and not a single one of them requires you to declare what type your data is. Requiring information that the compiler can figure out by itself does not make a language any weaker typed and does not change the type system. I'm under no delusion that Java's using Hindley-Milner, but it's worth pointing out nonetheless.

The difficulty of debugging languages like JavaScript or Python isn't helped by the type system, you're right, though this isn't turning it into that at all. Java will keep the type system it has now and won't be any less clear unless the code wasn't clear to begin with.

1

u/evil_burrito Mar 10 '16

Sure it will. When you, as a human, are stepping through the source code, there will be an extra step to figure out the type of a particular variable.

As a human who has to read other people's code, this would bother me, so I don't like it. We don't have to agree.

0

u/[deleted] Mar 10 '16

[deleted]

0

u/evil_burrito Mar 10 '16

As I said, I don't think this changes the type system in Java. I think this could make code harder for me to read. This is purely an opinion of mine. You don't have to share it. But I'm not wrong, because I'm stating my personal preference for reading code.

→ More replies (2)