groovy-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Sun <realblue...@hotmail.com>
Subject Re: About polish the generics type syntax for closure
Date Wed, 13 Feb 2019 09:38:29 GMT
Hi  Cédric,

> I'm 100% sure a syntax like that has been discussed in the past
Well...I missed that discussion...

> 1. consistency between using annotations and a type-checking only feature
I propose to transform `Closure<String, Number -> Date>` to the
annotations(i.e. `@ClosureParams`), so we can keep the consistency.

> 2. what about polymorphic closures (aka closures which accept different
> kind of arguments)
You mean something like `Closure<String, Number -> Date>`?

> 3. the arrow syntax making it hard to read, in particular when the
> argument types have generics themselves
It depends developers' preferences... e.g.

①```
Closure<String, Tuple2&lt;Number, String>  ->  Date>
```
VS
②```
@ClosureParams(value= SimpleType.class, options="String, Tuple2<Number,
String>") Closure<Date>
```

Syntax① looks better to me ;-)


Cheers,
Daniel.Sun





--
Sent from: http://groovy.329449.n5.nabble.com/Groovy-Dev-f372993.html

Mime
View raw message