Hi,

I don't know how to code this, any help appreciated. 

I want to have a concrete type that has a field referencing any of the 
subtypes of an(other) abstract type. How would I write that? 

This is one of my many attempts: 

type SQLFoo{T <: AbstractModel}
  model_name::Type{T}


  SQLFoo(model_name) = new(model_name)
end


julia> issubtype(Repo, AbstractModel)
true

julia> SQLFoo(Repo)
ERROR: MethodError: `convert` has no method matching convert(::Type{SQLFoo{T
<:AbstractModel}}, ::Type{Repo})
This may have arisen from a call to the constructor SQLFoo{T<:AbstractModel
}(...),
since type constructors fall back to convert methods.
Closest candidates are:
  call{T}(::Type{T}, ::Any)
  convert{T}(::Type{T}, ::T)
 in call at essentials.jl:56


Thanks,
-- Adrian

Reply via email to