On 13.02.19 10:38, Daniel Sun wrote:
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>`?

lets traget complicated overloads.. say you have a method that can take a Closure with no arguments, or with 1 argument of type X, or 2 arguments of types Y and Z... maybe they even return different types.

That is quite a lot to take for a static type system. Which is why most type systems do not allow that kind of flexibility. @ClosureParams is actually more flexible than many annotations methods in other computer programs.... but the syntax is, I agree, not nice. So I do like the proposal. I would also suggest something like Closure<(String,Number):Date> and Closure<():R1;(X):R2;(Y,Z):R3> for the case above (I would probably use multiple lines for that actually).

bye Jochen

Reply via email to