Just add

Base.eltype{F<:Foo}(::Type{F})=eltype(super(F))

--Tim

On Tuesday, March 03, 2015 06:58:53 PM Sheehan Olver wrote:
> Suppose I have
> 
> abstract Foo{T}
> immutable Foo1{T} <:Foo{T} end
> immutable Foo2{T} <:Foo{T} end
> 
> 
> 
> How can I write a function that returns T given the type?  E.g.: I want to
> do
> 
> Base.eltype(::Type{Foo{T}})=T
> 
> 
> But this won't work for eltype(Foo1{T})

Reply via email to