Open mtfishman opened 2 years ago
So the closest thing in Base
that handles undefined values is probably vcat
:
julia> vcat(Vector{String}(undef, 3), ["a", "b", "c"])
6-element Vector{String}:
#undef
#undef
#undef
"a"
"b"
"c"
julia> vcat(["a", "b", "c"], Vector{String}(undef, 3))
6-element Vector{String}:
"a"
"b"
"c"
#undef
#undef
#undef
julia> vcat(Vector{String}(undef, 3), [1, 2, 3])
ERROR: UndefRefError: access to undefined reference
Stacktrace:
[1] getindex
@ ./array.jl:861 [inlined]
[2] setindex!
@ ./array.jl:916 [inlined]
[3] _typed_vcat!(a::Vector{Any}, V::Tuple{Vector{String}, Vector{Int64}})
@ Base ./abstractarray.jl:1551
[4] _typed_vcat
@ ./abstractarray.jl:1543 [inlined]
[5] typed_vcat
@ ./abstractarray.jl:1619 [inlined]
[6] vcat(::Vector{String}, ::Vector{Int64})
@ SparseArrays ~/julia-1.7.2/share/julia/stdlib/v1.7/SparseArrays/src/sparsevector.jl:1123
[7] top-level scope
@ REPL[8]:1
julia> vcat([1, 2, 3], Vector{String}(undef, 3))
ERROR: UndefRefError: access to undefined reference
Stacktrace:
[1] getindex
@ ./array.jl:861 [inlined]
[2] setindex!
@ ./array.jl:916 [inlined]
[3] _typed_vcat!(a::Vector{Any}, V::Tuple{Vector{Int64}, Vector{String}})
@ Base ./abstractarray.jl:1551
[4] _typed_vcat
@ ./abstractarray.jl:1543 [inlined]
[5] typed_vcat
@ ./abstractarray.jl:1619 [inlined]
[6] vcat(::Vector{Int64}, ::Vector{String})
@ SparseArrays ~/julia-1.7.2/share/julia/stdlib/v1.7/SparseArrays/src/sparsevector.jl:1123
[7] top-level scope
@ REPL[9]:1
We are going to need something like istokenassigned
guards around things in both copyto!
and merge!
. (We cannot support mergewith!
in this case).
Here is another
undef
issue I came across:This may point to a need for fixing
copyto!
withundef
, which would fix this and the issue withcopy
fixed in #85.