-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
Open
Labels
collectionsData structures holding multiple items, e.g. setsData structures holding multiple items, e.g. setsinvalidIndicates that an issue or pull request is no longer relevantIndicates that an issue or pull request is no longer relevantiterationInvolves iteration or the iteration protocolInvolves iteration or the iteration protocol
Description
I am puzzled on why eltype
does not infer more precisely for Iterators.map(f, iterators...)
, especially when both the eltype
of the input iterators and the return type of f
seem to be inferable.
Would it be possible to improve the eltype
inference for Iterators
.
julia> fun(x) = x^2
fun (generic function with 1 method)
julia> a = Iterators.map(fun, 1:3)
Base.Generator{UnitRange{Int64}, typeof(fun)}(fun, 1:3)
julia> eltype(a)
Any # Expected: Int
This enhancement could help improve type stability and make Iterators.map
more consistent with the inferred types of other Julia constructs.
Metadata
Metadata
Assignees
Labels
collectionsData structures holding multiple items, e.g. setsData structures holding multiple items, e.g. setsinvalidIndicates that an issue or pull request is no longer relevantIndicates that an issue or pull request is no longer relevantiterationInvolves iteration or the iteration protocolInvolves iteration or the iteration protocol