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

74

u/evil_burrito Mar 09 '16 edited Mar 10 '16

I think one of the problems of untyped or weakly-typed languages is that they can be difficult to debug or understand somebody else's code.

I'm a fan of strong typing. I doubt that puts me in the majority here.

Edit: I'm simply stating a personal preference here: I think this will decrease the readability of source code. We don't all have to agree.

Edit: I can see how my original comment was poorly worded. I didn't mean to say, "I think this change will make Java less than a strongly-typed language", I meant to say, "I think this change might make Java read like less than a strongly-typed language".

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.

-4

u/NimChimspky Mar 10 '16

But I'm not wrong, because I'm stating my personal preference

lol

Why are you even commenting.

→ More replies (1)