If we know the desired target type of a closure, and the parameters are 
compatible, we could generate a Closure class which implements the applicable 
Functional Interface (such as Function<A,B>, Predicate<Thing> or whatever). For 
static Groovy, we could then skip the coercion.

-Jesper

> On 13 Feb 2019, at 18.40, Daniel.Sun <sun...@apache.org> wrote:
> 
> Hi Jochen,
> 
>     I really like your suggestion! which can solve all problems caused by
> closure's versatility.
> 
>     Groovy is groovy because it is Groovy, i.e. not another Java. Closure
> is a killer feature in Groovy, so it's better to refine it if possible ;-)   
> 
>      P.S. another crazy proposal, make closure based on native lambda in
> all cases... then closure will be much thinner and should gain better
> performance.
> 
> Cheers,
> Daniel.Sun
> 
> 
> 
> 
> -----
> Apache Groovy committer 
> Blog: http://blog.sunlan.me 
> Twitter: @daniel_sun 
> 
> --
> Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html

Reply via email to