groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Cédric Champeau <cedric.champ...@gmail.com>
Subject Re: About polish the generics type syntax for closure
Date Wed, 13 Feb 2019 08:44:22 GMT
I'm 100% sure a syntax like that has been discussed in the past, and
discarded for different reasons:

1. consistency between using annotations and a type-checking only feature
2. what about polymorphic closures (aka closures which accept different
kind of arguments)
3. the arrow syntax making it hard to read, in particular when the argument
types have generics themselves

Happy to reopen the discussion, but please keep this in mind.

Le mer. 13 févr. 2019 à 09:39, Daniel Sun <realbluesun@hotmail.com> a
écrit :

> Hi Guillaume,
>
> > What about the various cases, like no-arg closures?
>       How about `Closure< -> V>` ?
>
>       It is similar to the syntax of closure. More examples:
>
> 1)
> `Closure< String, Number -> Date>`
>
> is responding to
>
> ```
> { String x, Number y ->
>      return new Date()
> }
> ```
>
> 2)
> `Closure<   -> Date>`
>
> is responding to
>
> ```
> {  ->
>      return new Date()
> }
> ```
>
> 3)
> `Closure<Date>` means argument generics type information is not available
>
> Cheers,
> Daniel.Sun
>
>
>
> --
> Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html
>

Mime
View raw message