I have a very common problem for which I still don’t have a clear solution in Julia:
abstract AbstractFoo{N,T}
dimension{N,T}(::AbstractFoo{N,T}) = N
coordtype{N,T}(::AbstractFoo{N,T}) = T
abstract AbstractContainer{F}
immutable Container{F<:AbstractFoo} <: AbstractContainer{F}
state::Vector{coordtype(F)} # ERROR: MethodError: no method matching coordtype(::TypeVar)
end
The natural design above in which the container is parametrized by its element type doesn’t work. This problem was initially introduced in another thread but I think it deserves a thread on its own as well as a step-by-step explanation on what is the best current solution in Julia v0.5.