[swift-evolution] [Proposal] Conventionalizing stride semantics

Dave Abrahams dabrahams at apple.com
Thu Mar 3 16:25:14 CST 2016


on Thu Mar 03 2016, Erica Sadun <erica-AT-ericasadun.com> wrote:

> Should ranges drop that precondition then? So they can represent
> forward and backward progressions?

I'm very reluctant, though I'll admit my reasoning is based more on gut
design instict than anything rational.  

If you look at the work Dmitri is doing, the requirements on indices are
being weakened to Equatable but then strengthened to Comparable, in part
so we can do range validation and catch errors early.  It feels very
weird to me to say that you can form a Range of any two equatable
things.  At that point, one almost might as well replace Range with
(T,T) where T:Equatable.

-- 
-Dave


More information about the swift-evolution mailing list