What is a DataType exactly and why isn't a Vector a DataType?

Topic says it all.
Thanks

An instance of Vector{T} object is an Array{T,1}, but Vector{T} itself is a DataType.

julia> typeof(Vector{Any})
DataType

julia> typeof(Vector{Any}())
Array{Any,1}

julia> typeof(ans)
DataType

I see, then Unions are not DataTypes.

julia> Vector isa DataType
false

julia> Vector{Any} isa DataType
true

Seems you are right,

julia> typeof(Vector) |> supertype
Type{T}

julia> Vector isa Type
true

julia> Vector{Any} isa Type
true

They are of type Type instead of DataType.

Correct; a type like Vector{Int} is a DataType because it has concrete properties like memory layout. Vector on the other hand expresses the union of Vector{T} types for all values of T, so it’s a more abstract concept.

5 Likes