groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesper Steen Møller <jes...@selskabet.org>
Subject Re: About the callable native lambda
Date Thu, 01 Feb 2018 13:10:58 GMT
Hi again 

> On 1 Feb 2018, at 13.48, Jochen Theodorou <blackdrag@gmx.org> wrote:
> 
> [...]
>> For static compilation, r1() and r2() should work IMHO, and r3() should be rejected.
This shouldn't surprise anyone, I think.
> 
> you mean because the m has a return value and r3() is void? That is currently passing
compilation and the result will be null. This covers with the dynamic version.
> 

No, I mean because r3 (statically) is a java.lang.Object, and Object has no call() method
and is not a SAM:

> you surely did mean:
> 
>>> def n(Runnable q1, Predicate<String> q2, Q q2, q3) {
>>>     q1()
>>>     q2()
>>>     q3() >>      q4()
>>> }
>>> m(new Q(), new Q(), new Q(), new Q())
> 
> I expect this to work then too ;)


Yeah, the mail wasn't complete. I've fixed the example, re-sent the mail, and suggested (IMHO)
non-surprising semantics.

-Jesper


Mime
View raw message