Implementing recursive lambda with MethodHandle
    Joshua Bloch 
    jjb at google.com
       
    Mon Feb 22 10:38:37 PST 2010
    
    
  
Alex,
On Mon, Feb 22, 2010 at 10:11 AM, Alex Blewitt <alex.blewitt at gmail.com>wrote:
>
> I'm not sure why a temporary assignment to 'thisFn' is an better than using
> 'this' in place - on the other hand, if one wanted to, one could do both the
> above and the below.
>
>    #i(int i) {
>>       #int(int) thisFn = this;
>>       return i == 0 ? 1 : i * thisFn.(i - 1);
>>    };
>>
>>
It eliminates the circularity in the definition of the type of the lambda:
it's clearly #int(int). It's visual clutter, but at least it doesn't clutter
up the enclosing namespace.
            Josh
    
    
More information about the lambda-dev
mailing list