r/programming • • Feb 22 '15

Java Makes Programmers Want To Do Absolutely Anything Else With Their Time

http://www.forbes.com/sites/quora/2015/02/21/java-makes-programmers-want-to-do-absolutely-anything-else-with-their-time/
35 Upvotes

636 comments sorted by

View all comments

Show parent comments

5

u/giuseppemag Feb 22 '15

What sort of argument against type inference is this?!?

Type inference just requires signatures, which should well be present in any precompiled library (linking is otherwise impossible). In principle Java has nothing that would prevent type inference, precisely like var in C#.

-1

u/[deleted] Feb 22 '15

What sort of argument against type inference is this?!?

I'd argue that IDEA's struggle to provide correct and meaningful Scala type information (the best form of type checking can often yield false positives) is a good argument against it.

1

u/giuseppemag Feb 28 '15

F# or Haskell have no such struggle. It just means that this specific implementation is of no such good quality.

-3

u/contantofaz Feb 22 '15 edited Feb 22 '15

I don't know how to respond to that. I think that ultimately the proof is in the pudding. Or as in Jerry Maguire: "Show me the money!" If type inference is no problem for libraries, multiple competing implementations, backward compatibility, etc, show me the money! :-)

3

u/ihcn Feb 22 '15

The compiler absolutely must know the type of every variable, because otherwise it couldn't possibly give you a mismatched type error.

-2

u/contantofaz Feb 22 '15

Yes. But it's the work of following the dependency to the original types that must be considered too. In some languages types can be inferred in a lot of places. More so than just local to a function. That extra work is not always advisable. Many languages in the Java ecosystem can share the libraries thanks to the effort that Java put into making the libraries easier to share. But once the library follows the Java standards, they may lose some unique informations as required by some languages in the source-code. Information that could implicitly depend on private types even. So language designers are sometimes skeptical of how much information can be leaked in type inference support.

3

u/jamougha Feb 22 '15

Scala already does this.

1

u/giuseppemag Feb 28 '15

F# and C#...