Lacking documentation about non-types as type parameters

Type parameters can be non-types that are isbits (see 3rd bullet point in Types · The Julia Language):

julia> struct A{T} end

julia> A{1.2}
A{1.2}

julia> A{'a'}
A{'a'}

julia> A{π}
A{π}

julia> A{1//2}
A{1//2}

julia> A{1}
A{1}

While this is useful for things like StaticArrays and more, it hardly gets mentioned in the documentation (with the exception of that 3rd bullet point). There is an issue about applying constraint on said non-type-parameters here, but I’d argue that this should receive more attention in the documentation itself.

I might be wrong however.

What do you think?

7 Likes