JuliaArrays / JuliaArrays/StructArrays.jl
construct empty vector with `StructVector{Foo1}()`
Open
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 402
- Forks
- 49
- PR merge metrics
- No merged PRs in 30d
Description
julia> struct Foo1
x::Int
y::Int
end
julia> Vector{Foo1}()
Foo1[]
julia> StructVector{Foo1}()
ERROR: type NamedTuple has no field x
Stacktrace:
[1] (::Base.var"#164#167"{(:x, :y), NamedTuple{(), Tuple{}}})(n::Int64)
@ Base ./none:0
[2] iterate
@ ./generator.jl:47 [inlined]
[3] (NamedTuple{(:x, :y), T} where T<:Tuple)(nt::NamedTuple{(), Tuple{}})
@ Base ./namedtuple.jl:99
[4] (StructArray{Foo1, N, C, I} where {N, C<:Union{Tuple, NamedTuple}, I})(c::NamedTuple{(), Tuple{}})
@ StructArrays ~/repos/StructArrays.jl/src/structarray.jl:92
[5] #_#5
@ ~/repos/StructArrays.jl/src/structarray.jl:100 [inlined]
[6] StructArray
@ ~/repos/StructArrays.jl/src/structarray.jl:100 [inlined]
[7] #_#7
@ ~/repos/StructArrays.jl/src/structarray.jl:109 [inlined]
[8] (StructVector{Foo1, C, I} where {C<:Union{Tuple, NamedTuple}, I})()
@ StructArrays ~/repos/StructArrays.jl/src/structarray.jl:109
[9] top-level scope
@ REPL[56]:1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the empty-construction example in Julia, then inspect src/structarray.jl around lines 92, 100, and 109 where StructVector delegates to StructArray. Confirm that the completed behavior is an empty StructVector{Foo1}() without the NamedTuple field error, matching Vector{Foo1}().
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- data
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100