Closed aplavin closed 2 weeks ago
julia> eltype([(i:i, anns[i]) for i in 1:0])
Tuple{UnitRange{Int64}, Any}
julia> eltype([(i:i, anns[i]) for i in 1:2])
Tuple{UnitRange{Int64}, Pair{Symbol, Any}}
You could specify the element type when constructing the vector, though.
Seems better to verify during construction than to restrict the container type, or?
We could define something like
AnnotatedString(str::AbstractString, itr) =
AnnotatedString(str, Tuple{UnitRange{Int64}, Pair{Symbol, Any}}(collect(itr)))
Thoughts?
If that seem good, I'll happily whip up a PR.
I think the constructor type constraints are too restrictive.