Printing of UnionAll types used to be honest:
Julia 1.6
julia> struct A{asdf, qwer} end
julia> A{Int}
A{Int64, qwer} where qwer
julia> using StructArrays
julia> struct Foo
x::Int
end
julia> StructArray{Foo}
StructArray{Foo, N, C, I} where {N, C<:Union{Tuple, NamedTuple}, I}
But as of Julia version 1.7, printing of UnionAll types is misleading:
Julia 1.7
julia> struct A{asdf, qwer} end
julia> A{Int}
A{Int64}
julia> using StructArrays
julia> struct Foo
x::Int
end
julia> StructArray{Foo}
StructArray{Foo}
The printing in 1.7+ could easily lead a programmer to believe that A{Int}
and StructArray{Foo}
are concrete types. In fact, here’s a Discourse question where the misleading printing might have been a contributing factor to the mistake that was made.
Question
Why was this change made to UnionAll printing?
Footnote
I’m aware that StructArray{Foo}
is equivalent to the long form:
julia> StructArray{Foo} == (StructArray{Foo, N, C, I} where {N, C<:Union{Tuple, NamedTuple}, I})
true
However, I think printing StructArray{Foo}
instead of the long form just has too much potential for confusion and obfuscation.