Vararg parametric types


#1

Hi,

I’m a very long time lurker, and in general, I love the design of Julia. I think it’s finally time I used it for a real project, and unfortunately, I am already running into an issue which I can’t solve. I’ve searched the docs (read most of them), I tried Google, stackoverflow, the old google groups. Yet, I still haven’t been able to find the answer.

Is it possible to create a vararg parameteric type? I’ve tried a number of different things, including Tuples, Vararg, etc but can’t get the syntax/usage right. What I’m trying to do is something like this:

I’ve tried

abstract MyType{T…}

abstract MyType{T <: Vararg}

abstract MyType{T <: Tuple{Vararg}}

and many other things.

Any suggestions please?

Many thanks,

Tom


#2

Tuple is very special in the type-system and is the only type that is allowed to be parameterized by Vararg. The closest you can do for a regular type is to parameterize it with a Vararg Tuple:

abstract MyType{T <: Tuple}

#3

Thank you very much.