Open
Description
I want to use valtype
and keytype
as a generic way of getting the value type and index type for a collection—and have the operation be compatible with dict-like collections. It seems some parts of this interface are missing so it would be nice to add fallbacks.
The valtype
docstring says:
- For Array
- "Return the value type of an array. This is identical to eltype and is provided mainly for compatibility with the dictionary interface."
- For Dict
- "Get the value type of a dictionary type. Behaves similarly to eltype."
Based on this I would have guessed that valtype
would fallback to eltype
so that it can be compatible with any collection. Right now you run into things like
julia> eltype(Set{Float64})
Float64
julia> valtype(Set{Float64})
ERROR: MethodError: no method matching valtype(::Type{Set{Float64}})
which hurts the general use of this function.