Topic says it all. I would like to do something like:
struct MySpecialType{T<:Type} <: Type{T}
end
Topic says it all. I would like to do something like:
struct MySpecialType{T<:Type} <: Type{T}
end
Types can only be subtypes of abstract types. I think Type
is concrete right? I’m sure the answer is somewhere in here, but that page is long and I’ve read it probably 3 or 4 times in the last couple of years and still haven’t grasped all of the complexity.
That said, can you say more about what you’re actual use case is? It’s possible that there’s a way to accomplish what you want to do, just not in this specific way.
Type
is not a real type, it is neither concrete nor abstract.
It is a special magic thing for dispatch purposes.
Unlike DateType
which is is the type of types and is concreete
(Type
also matches dispatch with UnionAlls
i.e. parametric types with free parameters. (where as DataType
does not))
Things that make it special
It is a parametric super-type of DataType
,
but DataType
is not parameteric – that is not allowed.
And linked to this information kind of jumps over the DataType
step:
julia> Int isa DataType
true
julia> Int isa Type{Int}
true
julia> DataType <: Type{Int}
false
julia> supertype(DataType)
Type{T}
julia> isconcretetype(Type)
false
julia> isabstracttype(Type)
true
Is this wrong, then ?