Re: [julia-users] fieldtype() for parameterised types

2016-09-19 Thread 'Greg Plowman' via julia-users
Ah, TypeVars, parameter and bound fields. Thanks Tim. This looks like what I'm after. Will investigate.

Re: [julia-users] fieldtype() for parameterised types

2016-09-19 Thread Tim Holy
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},

[julia-users] fieldtype() for parameterised types

2016-09-19 Thread 'Greg Plowman' via julia-users
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