lambda-repo workaround [was Re: Can't get lambda forest to work]
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Thu Jun 17 06:10:05 PDT 2010
On 17/06/10 13:42, Andrew John Hughes wrote:
> On 17 June 2010 13:28, Maurizio Cimadamore
> <maurizio.cimadamore at oracle.com> wrote:
>
>> This is fixed now.
>>
>> Thanks
>> Maurizio
>>
>>
> Thanks for the quick fix. I noticed an #int(int) won't accept an
> Integer. Was this a deliberate design decision?
>
What do you mean?
#int(int) square = #(int x)(x * x);
...
Integer y = ...
System.out.println(y + " squared is " + square.(y));
This seems to work just fine...
Or you mean the #(int)int type won't accept a #(Integer)int type? The
spec (in their current form) doesn't allow for such interoperability
(argument types on the RHS need to be supertypes of argument types on
the LHS).
Maurizio
>
>> On 17/06/10 13:14, Maurizio Cimadamore wrote:
>>
>>> On 17/06/10 13:06, Andrew John Hughes wrote:
>>>
>>>
>>>> public static void main(String[] args)
>>>> {
>>>> #int(int) square = #(int x)(x * x);
>>>> #int() fortyTwo = #()(42);
>>>> Integer y = Integer.parseInt(args[0]);
>>>> System.out.println("Hello, the meaning of life is " + fortyTwo.());
>>>> System.out.println(y + " squared is " + square.(y));
>>>>
>>>>
>>>>
>>>>
>>> This is a straight prototype bug ;-)
>>> I have a fix for it will be pushing it soon. The problem is the boxing
>>> (you are passing a Integer where the closure accepts a 'int'). The
>>> prototype works ok, but an assertion causes the crash (disabling
>>> assertions also works fine).
>>>
>>> Maurizio
>>>
>>>
>>>
>>
>>
>>
>
>
>
More information about the lambda-dev
mailing list