Overload resolution simplification
daniel.smith at oracle.com
Mon Aug 12 11:27:40 PDT 2013
On Aug 10, 2013, at 3:58 PM, Remi Forax <forax at univ-mlv.fr> wrote:
>> What were proposing here is to have less magic in the interplay of overlaod resolution and inference.
> It's not less magic. It's no magic.
> People expect that lambdas will work reasonably well with overloads.
A small comment; generally, I pretty much endorse everything Maurizio had to say.
People expect target typing of combinators to work; they also want overloading on functional interface types to work. ("Work" here means "support implicit lambdas".) You can't do both at the same time, given our prime directive: overload resolution is context-independent.
So we worked hard to make the compiler smart enough to pick which feature to support on a case-by-case basis. And we've found that, despite our best efforts to reduce complexity, it's still hard for the average user to understand; the typical outcome when it doesn't "just work" will be a complaint that the compiler should have known that the other feature is what was wanted here.
We get a much simpler story if we just pick one of the features and stick to it (when inferring types of implicit lambdas). Practical experience has told us that target typing of combinators is a lot more useful than overloading on functional interface types. Hence, the bias towards making that the "magic" that we support.
More information about the lambda-spec-observers