More Typing Problems

Ming-Yee Iu mingyeeiu+lambda at
Tue Sep 7 05:38:12 PDT 2010

The point I'm trying to make is not that I don't understand why the
code doesn't work. I'm mostly pointing out that the proposed type
inference algorithm for Java7 is uncompetitive with C#'s type
inference algorithm. This style of code works fine in C#. Poor type
inferencing will make writing LINQish queries in Java7 more verbose
and error-prone.

The type inferencer should either "just work" (there are well-defined
situations when you can leave out types) or it "doesn't work" (when
using lambdas, you should put types everywhere or you'll get obscure
error messages). These sorts of errors suggests that the type
inferencer falls into the "sometimes works" category, meaning that in
practice, programmers will end up putting types everywhere in their
lambdas when working with generics (i.e. it "doesn't work").

Even worse, right now the compiler is blaming the programmer for
writing incorrect code when it is, in fact, a failure of the type
inferencer that is causing the compilation problems.

More information about the lambda-dev mailing list