`UnorderedDictionary` with more keys than values doesn't throw
I expected this to throw an exception.
julia> Dictionary(['a', 'b'], [1])
ERROR: AssertionError: length(values) == length(_values(inds))
julia> UnorderedDictionary(['a', 'b'], [1])
1-element UnorderedDictionary{Char, Int64}
'a' │ 1
Okay, this one is because internally we use zip and iterate that.
Originally zip would error out when the collections had different lengths, but now it is more forgiving (I would have preferred introducing a new funciton, but there you go). Perhaps being this forgiving here would only encourage mistakes.
We should probably fix this by comparing the lengths of the inputs (but only if the iterators possess the HasLength trait...)
We should probably fix this by comparing the lengths of the inputs (but only if the iterators possess the HasLength trait...)
I think if length(collect(x)) != length(collect(y)) then UnorderedDictionary(x,y) should still error even if x or y doesn't HasLength.
For sure - we can just do that check a little earlier with HasLength than without.