More Typing Problems
neal at gafter.com
Tue Sep 7 07:00:08 PDT 2010
On Tue, Sep 7, 2010 at 6:16 AM, Maurizio Cimadamore <
maurizio.cimadamore at oracle.com> wrote:
> On 07/09/10 13:38, Ming-Yee Iu wrote:
> > 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").
> point taken - however your comments do not directly refer to the changes
> implemented in the lambda branch; I read some kind of general discomfort
> in the way in which Java type-inference work (as currently specified in
> the JLS); so, while in principle I could agree with you, I think that
> we're being a bit off-topic here...
I believe he's referring to the inference of lambda parameter types. These
are not specified by the JLS (yet), and there is an equivalent problem
solved in C# using completely different and more flexible techniques.
More information about the lambda-dev