(Posted originally as NullableArrays issue #190, likely should have started here on discourse before filing an issue…)
Not sure if I missed something about iteration interfaces or NullableArrays
, but consider the following (valid for NullableArrays 0.1.0 and master, julia v0.5.1 and 0.6.0-pre.beta.14, on ubuntu 14):
julia> type A
arr::Array{String}
end
julia> a = A(String[])
A(String[])
julia> start(a.arr)
1
julia> done(a.arr, 1)
true
julia> using NullableArrays
julia> type B
arr::NullableArray{String}
end
julia> b = B(NullableArray{String}[])
B(Nullable{String}[])
julia> start(b.arr)
(Base.OneTo(0), 1)
julia> done(b.arr, 1)
ERROR: BoundsError
Stacktrace:
[1] getindex at ./number.jl:38 [inlined]
[2] done(::NullableArrays.NullableArray{String,1}, ::Int64) at ./abstractarray.jl:753
To be sure, when NullableArray is not a field:
julia> c = NullableArray{String}[]
0-element Array{NullableArrays.NullableArray{String,N} where N,1}
julia> start(c)
1
julia> done(c, 1)
true