groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jochen Theodorou <blackd...@gmx.org>
Subject Re: SAM type closure coercion
Date Wed, 18 Jan 2017 14:19:11 GMT
ok, I see... we currently do not make use of that information, but 
could. Only trouble is that we will be "less expressive" than Java for 
these cases.

bye Jochen

On 18.01.2017 14:39, Andres Almiray wrote:
> I meant that { String arg0, int arg1 -> } gives us arity and types,
> whereas { arg0, arg1 -> } only gives arity.
> Also compare { List arg0, int arg1 -> } vs { List<String> arg0, int arg1
> -> }, the former should be doable whereas the latter will prove difficult.
>
> This is what I meant by plain typed arguments. I explained myself badly
> and left out "generics" from the previous message.
>
> Cheers,
> Andres
>
> -------------------------------------------
> Java Champion; Groovy Enthusiast
> http://jroller.com/aalmiray
> http://www.linkedin.com/in/aalmiray
> --
> What goes up, must come down. Ask any system administrator.
> There are 10 types of people in the world: Those who understand binary,
> and those who don't.
> To understand recursion, we must first understand recursion.
>
> On Wed, Jan 18, 2017 at 2:22 PM, Jochen Theodorou <blackdrag@gmx.org
> <mailto:blackdrag@gmx.org>> wrote:
>
>
>     On 18.01.2017 14:09, Andres Almiray wrote:
>
>         Agreed.
>
>         I almost forgot about the special arity case of defining a
>         closure as {
>         /* do something */ } as it can be called with either 0 or 1
>         arguments,
>         where as { -> } accepts no arguments and { x -> } takes exactly one
>         argument.
>
>         Would it a a good compromise to support plain typed arguments
>         out of the
>         box, that is { String arg0, int arg1 -> } vs { arg0, arg1 -> } ?
>
>
>     nothing prevents you from writing { String arg0, int arg1 -> }
>     today. And yes, we can make that this helps.
>
>     bye Jochen
>
>

Mime
View raw message