Skip to content

Conversation

@Keno
Copy link
Member

@Keno Keno commented Jan 24, 2018

The iterator wrappers assume that eltype is called on the type of
the wrapped iterator, not the value itself, so all objects that
implement these traits need to do so. Audit all of them in base
and make sure that's the case.

@Keno Keno requested a review from JeffBezanson January 24, 2018 20:43
end

eltype(P::ProductIterator) = _prod_eltype(P.iterators)
eltype(::Type{<:ProductIterator{I}}) where {I} = _prod_eltype((I.parameters...,))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally these should be rewritten to use tuple_type_head.

parent(a::ReinterpretArray) = a.parent

eltype(a::ReinterpretArray{T}) where {T} = T
eltype(a::Type{<:ReinterpretArray{T}}) where {T} = T
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary; should be inherited from AbstractArray.

Base.$f(s::$G) = $f(s.s)
end
end
Base.eltype(::Type{<:G}) = eltype(fieldtype(G, :s))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also covered by AbstractSet I think.

@Keno Keno added the iteration Involves iteration or the iteration protocol label Jan 24, 2018
@ararslan ararslan added the traits Traits, sometimes called Tim Holy Traits label Jan 25, 2018
The iterator wrappers assume that eltype is called on the type of
the wrapped iterator, not the value itself, so all objects that
implement these traits need to do so. Audit all of them in base
and make sure that's the case.
@mschauer
Copy link
Contributor

This forgot to update the docstring

help?> Base.IteratorSize
  IteratorSize(itertype::Type) -> IteratorSize

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

iteration Involves iteration or the iteration protocol traits Traits, sometimes called Tim Holy Traits

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants