Ah, TypeVars, parameter and bound fields.
Thanks Tim.
This looks like what I'm after. Will investigate.
You don't have to do this in the type definition, you can do it at
introspection time:
fieldtype(Foo{Float64,3},:a) returns Array{T,N}
fieldtype(Foo{Float64,3},:b) returns Array{Float64,3}
More generally:
julia> T, N = TypeVar(:T, true), TypeVar(:N, true)
(T,N)
julia> fieldtype(Foo{T,N},
For a parameterised composite type, I want to distinguish between
fields defined with parameters and generic fields.
An example is probably best:
type Foo{T,N}
a::Array
b::Array{T,N}
end
fieldtype(Foo,:a) returns Array{T,N}
fieldtype(Foo,:b) returns Array{T,N}
And if I use