I think I found another way (looking at the source):

length(mytupletype.parameters)

Is this something I can rely on, or some internal API that may change?

Also, would it make sense to define the whole abstract array interface
for Tuple types, eg

size(t::Type{Tuple}) = (length(t.parameters),)
getindex(t::Type{Tuple}, index::Int) = t.parameters[index]
etc

in Base, or am I abusing Tuple types here?

Best,

Tamas

On Wed, Mar 23 2016, Tamas Papp wrote:

> Hi,
>
> How do I get the length of a tuple _type_? In other words, is there a
> standard idiom for 
>
> foo{N}(::Type{NTuple{N}}) = N
>
> Best,
>
> Tamas

Reply via email to