Type inference of parameters

Neal Gafter neal at gafter.com
Thu Jul 8 08:13:55 PDT 2010

On Wed, Jul 7, 2010 at 4:06 PM, maurizio cimadamore <
maurizio.cimadamore at oracle.com> wrote:

> In the general case, it is not clear how the compiler should attribute
> the lambda body when there is no unique target for the SAM conversion;
> one option would be to do a trial-and-error attribution, as described in
> [1]. Instead of solving a problem by introducing another one (as Josh
> said in a separate post, Java method resolution is one of the most
> complicated parts of the language), we decided to ban this kind of
> type-inference - eventually the user will be able to disambiguate at the
> call site in a very java-ish fashion:
> call(SAM1 { x -> System.out.println(x); });

Solving the compiler-writer's problem by pushing the problem onto the
programmer is tried and true, but exactly backwards.  The point of a
language and compiler is to simplify the programmer's life, at the expense
of complicating the compiler-writer's job[CWFEA86].


[CWFEA86] The Compiler-Writer's Full Employment Act of 1986.

More information about the lambda-dev mailing list