Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FieldArray could display better #1223

Open
danielwe opened this issue Dec 5, 2023 · 1 comment
Open

FieldArray could display better #1223

danielwe opened this issue Dec 5, 2023 · 1 comment

Comments

@danielwe
Copy link

danielwe commented Dec 5, 2023

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
@stevengj
Copy link
Contributor

stevengj commented Dec 5, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants