Overload resolution simplification

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Thu Aug 15 07:00:20 PDT 2013

On 15/08/13 14:24, Zhong Yu wrote:
> That is not a reason for Java to reject it too. Java traditionally
> does inference based on assignment context; it'll be nice to continue
> to do that even with lambda arguments.
>> >
Well - that wasn't the point of my email; several posts in this thread 
were of the kind - 'why can't you guys just do what C# does' ?
I only tried to show that there are similar limitations elsewhere.

I explained at least 3-4 times as to why it is actually a good design 
choice not to allow stuff as Comparator.comparing overload - but somehow 
the message doesn't get across. It's not like we are making something 
dumber or different from what it used to be; it's true Java does 
inference based on target context - but that inference has _never_ 
affected the outcome of overload resolution - which helps overload 
selection to remain tractable (i.e. not NP-hard, to go along with Eric 
Lippert). We'd like to keep it that way. That means sticking with a 
design principle that guided us in the past - but I do understand that 
much of this stuff is subtle and hard to disgest.


More information about the lambda-spec-observers mailing list