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: Lambda expression for Groovy 3
Date Wed, 19 Oct 2016 10:34:00 GMT
Hi Daniel

Be careful with that approach, as it won’t work for static methods — leading to very different
semantics for the two languages.
Also, you won’t be able to support constructor references without some new AST construct,
I guess.

-Jesper

> On 19. okt. 2016, at 12.23, daniel_sun <realbluesun@hotmail.com> wrote:
> 
> Hi Jochen,
> 
>      I plan to map Java's *::* to Groovy's *.&*, the following code is ok
> now. What do you think about it?
> 
> [1, 2, 3].stream().forEach(System.out.&println)          // object method,
> [1, 2, 3].stream().forEach(System.out::println) 
> [1, 2, 3].stream().forEach(Objects.&requireNonNull) // class method,  [1, 2,
> 3].stream().forEach(Objects::requireNonNull)
> 
> Cheers,
> Daniel.Sun
> 
> 
> 
> --
> View this message in context: http://groovy.329449.n5.nabble.com/Lambda-expression-for-Groovy-3-tp5736169p5736195.html
> Sent from the Groovy Dev mailing list archive at Nabble.com.


Mime
View raw message