anonymous method call

John Rose john.r.rose at oracle.com
Sat Jun 1 21:43:20 PDT 2013


On Jun 1, 2013, at 2:32 PM, Remi Forax <forax at univ-mlv.fr> wrote:

> This rule is awful because it means that if you add a method in a class 
> (or worst in a super class)
> you may broke an already existing code because you introduce a method 
> that will be used instead
> of calling the lambda.
> 
> so this syntax was rejected by the Expert Group :)

OK, this calls for a Devil's Advocate exercise:

We did something like this before with an iron-clad compatibility story.  Varargs and autobox were compatibly introduced by adding them as post-passes after a presumably failed overloading resolution

This rule could also (in principle) be applied to method name resolution, as a post-pass after presumably failed scoping.

I.e., if the method name 'foo' in foo(...) cannot be found, then attempt to find a variable name foo, which must then be typed as a functional type (or jli.MethodHandle? or jlr.Method?) and elide the superfluous name (something like 'apply' or 'invoke' or 'applyAsDouble') which is the unique method name for the functional type.

— John


More information about the lambda-dev mailing list