StaticArrays.jl
StaticArrays.jl copied to clipboard
`FieldArray` could display better
A FieldArray displays as an array, values only. It would be great if it showed the field names too---named fields are presumably the reason to use a FieldArray in the first place.
julia> using StaticArrays
julia> Base.@kwdef struct Foo <: FieldVector{2,Float64}
bar::Float64
baz::Float64
end
Foo
julia> Foo(bar=3.0, baz=5.0)
2-element Foo with indices SOneTo(2):
3.0
5.0
Compare LabelledArrays.jl:
julia> using LabelledArrays
julia> SLVector(bar=3.0, baz=5.0)
2-element SLArray{Tuple{2}, Float64, 1, 2, (:bar, :baz)} with indices SOneTo(2):
:bar => 3.0
:baz => 5.0
I would vote for something closer to NamedTuple display, i.e. display as something like:
julia> Foo(bar=3.0, baz=5.0)
2-element Foo with indices SOneTo(2):
bar = 3.0
baz = 5.0