I would say Groovy Closure with the Java syntax.


On October 18, 2016 8:21:34 PM GMT+02:00, Guillaume Laforge <glaforge@gmail.com> wrote:
Is it actually Groovy closures? or "real" Java lambdas?

On Tue, Oct 18, 2016 at 7:42 PM, Jochen Theodorou <blackdrag@gmx.org> wrote:

hah, I knew you can do it ;)

On 18.10.2016 18:34, daniel_sun wrote:
Jochen, lambda expression is fully supported now :)




在 "Jochen Theodorou [via Groovy]" <ml-node+[hidden email]
</user/SendEmail.jtp?type=node&node=5736176&i=0>>,2016年10月18日 00:37


    On 17.10.2016 17:40, daniel_sun wrote:
     > Hi all,
     >        Lambda expression for Groovy has been completed with a little
     > limitation, which is due to the existing closure whose parameter
    list can be
     > ambiguous to lambda expression, e.g. {a -> a} which can be parsed
    as a
     > lambda expression in a block, but we expect it a closure.

    I think that limitation is ok

     > In order to
     > resolve the ambiguities, the parentheses for parameters is a
    must, e.g.
     > *Java8* allows parentheses-less parameter for lambda when the
    parameter is
     > single and without type: e -> e, but *Groovy* only allows
    parameter with
     > parentheses: (e) -> e.
     >        *Here are some examples for lambda expression for Groovy:*
     > assert 9 == [1, 2, 3].stream().map((e) -> e + 1).reduce(0, (r, e)
    -> r + e)

    which means you cannot write
     > assert 9 == [1, 2, 3].stream().map(e -> e + 1).reduce(0, (r, e)
    -> r + e)

    which I find not so ok. Here again it would be no problem if it is
    recognized as Closure if that is more easy to accomplish.

    bye Jochen

    If you reply to this email, your message will be added to the
    discussion below:

    To unsubscribe from Lambda expression for Groovy 3, click here.

View this message in context: Re: Lambda expression for Groovy 3
Sent from the Groovy Dev mailing list archive
<http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html> at Nabble.com.

Guillaume Laforge
Apache Groovy committer & PMC Vice-President
Developer Advocate @ Google Cloud Platform

Sent from my Android device with K-9 Mail. Please excuse my brevity.