Reified Lambda Functions

Howard Lovatt howard.lovatt at iee.org
Fri Jan 8 03:15:22 PST 2010


Hi,

There are two primary motivations:

1. To get the performance up, particularly for primitives. If you don't then
you might as well just have short innner class syntax and use generics. The
ParallelArray API won't fly without fast primitive support for example.

2. To provide a better fit to the rest of Java than generics are. IE you can
have arrays of lambdas, instanceof tests, etc.

A secondary motivation was to see if it could be done :) (OK that is really
a primary, primary, motivation.)

Thanks for the comment,

 -- Howard.

2010/1/7 Fredrik Öhrström <fredrik.ohrstrom at oracle.com>

> Hi Howard!
> I am curious, what are the primary reasons for reifying lambdas? You
> mention performance... but for example if a lambda(closure) is used  as the
> body of a loop, the  optimizing JVM will inline the iteration code from the
> collection class and this will in turn inline the lambda as well. Thus
> effectively types outside of the lambda will be propagated into the lambda
> when the code is optimized since they will be part of the same AST.
>
> I think generic lambdas are quite a different beast than generic classes.
>
> //Fredrik
>
> Howard Lovatt skrev:
>
>> I have posted a *more* formal proposal for reifying lambdas (as suggested
>> by
>> Neal Gafter):
>>
>> http://www.artima.com/weblogs/viewpost.jsp?thread=278567
>>
>> This could be read in conjunction with the original informal proposal:
>>
>> http://www.artima.com/weblogs/viewpost.jsp?thread=277879
>>
>> Which is an easier read :)
>>
>>  -- Howard.
>>
>> 2010/1/3 Neal Gafter <neal at gafter.com>
>>
>>
>>
>>> On Sun, Jan 3, 2010 at 3:04 PM, Howard Lovatt <howard.lovatt at iee.org
>>> >wrote:
>>>
>>>
>>>
>>>> I have updated the post to cover your example; thanks it is another
>>>> difficult case that needs to be addressed. The updated  blog is at
>>>>
>>>>
>>>> http://www.artima.com/forums/flat.jsp?forum=106&thread=277879&start=0&msRange=15
>>>> .
>>>> I have included a list example like the one you gave. For comparing
>>>> lambda's
>>>> you need to use equals not ==.
>>>>
>>>> Keep the difficult cases coming there may be more subtile bugs in the
>>>> proposal that these examples will tease out.
>>>>
>>>>
>>>>
>>> It isn't clear how to generalize your particular examples into rules for
>>> handling all examples.  While the examples are helpful, they don't really
>>> provide much confidence in the concepts without those underlying rules.
>>>  Can
>>> you please try to formulate your proposal into a set of more generic
>>> rules
>>> for handling all cases?  Trying to formalize the rules would also help us
>>> (and you) to understand if and where rules might be missing.
>>>
>>>
>>>
>>> ______________________________________________________________________
>>> This email has been scanned by the MessageLabs Email Security System.
>>> For more information please visit http://www.messagelabs.com/email
>>> ______________________________________________________________________
>>>
>>>
>>>
>>
>>
>>
>>
>>
>
>
> ______________________________________________________________________
> This email has been scanned by the MessageLabs Email Security System.
> For more information please visit http://www.messagelabs.com/email______________________________________________________________________
>



-- 
 -- Howard.


More information about the lambda-dev mailing list