Method References and partial application

Dan Smith daniel.smith at oracle.com
Sat Jun 25 09:16:09 PDT 2011


Method references are still pretty unstable in their design.  This isn't a feature we've been considering recently, though.

My thinking is that, for anything more complex than just using a method as-is, a lambda expression is a completely reasonable fall-back.  Is there a reason that is not the case here?

           SAM2 sam2 = Test#multiply;
           SAM1 sam1 = { x -> Test.multiply(10,x) };
           SAM0 sam0 = { -> Test.multiply(10,20) };
           SAM0 sam00 = { -> sam1.apply(20) };

(If the compiler wants to recognize this pattern and optimize it in some way, all the better.)

—Dan

On Jun 25, 2011, at 4:38 AM, Ali Ebrahimi wrote:

> Hi Brian,
> Is partial application Support for Method References in current scope?
> 
> class Test{
>    public static int multiply(int x, int y){    return x * y;}
> 
>    public static void main(String... args){
>            SAM2 sam2 = Test#multiply;
>            SAM1 sam1 = Test#multiply(10,int);
>            SAM0 sam0 = Test#multiply(10,20);
>            SAM0 sam00 = sam1#apply(20);
>    }
> }
> 
> Best Regards,
> Ali Ebrahimi
> 



More information about the lambda-dev mailing list