groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andres Almiray <aalmi...@gmail.com>
Subject Re: SAM type closure coercion
Date Wed, 18 Jan 2017 13:39:42 GMT
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> 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