[RFC] New collections model: collections advance indices

In the RFC, I see that indices only requires `next`. I like this scheme a
lot, it's very altruistic, like in C++. Get, increment, end check - nothing
more is required to work with iterators.
I like extracting everything optional to Collection hierarchy, and don't
like adding Equatable, Comparable or Hashable constraints on iterators. If
you need Hashable in a specific scope, declare it as a generic constraint.
I didnt really read the whole RFC, so I could have misunderstood something.

In the RFC, I see that indices only requires `next`.

In the RFC, there's no Index protocol at all; Indices
are required to be Comparable.

I like this scheme a lot, it's very altruistic, like in C++. Get,
increment, end check - nothing more is required to work with
iterators.

FWIW, building a correct C++ iterator is so boilerplate-heavy and
occasionally subtle that people use libraries such as
http://www.boost.org/doc/libs/release/libs/iterator/doc/index.html

I like extracting everything optional to Collection hierarchy, and don't
like adding Equatable, Comparable or Hashable constraints on
iterators.

You can barely write any interesting generic algorithms at all without
the moral equivalent of Equatable indices.

If you need Hashable in a specific scope, declare it as a generic
constraint. I didnt really read the whole RFC, so I could have
misunderstood something.

I don't support making indices Hashable at this time; IMO that's part of
a much larger discussion that we need to have about regular types and
implicitly-generated conformances. Comparable is arguable either way,
but we are proposing to require it in part to be able to test the
semantics of a valid Range.

···

on Tue Mar 08 2016, Антон Жилин <swift-evolution@swift.org> wrote:

--
-Dave