Pedro,

endIndex is exclusive by definition. You can iterate over any collection by 
going from startIndex until you reach endIndex.

If we change endIndex on ranges, *all* generic iteration code will be broken 
when dealing with ranges, even the for statement.


I understand that there are two concerns here:

1) The desire to keep the semantics of 1...10 intact, so that you can access 
that 10 somehow (perhaps something like lastValidIndex?), the description 
returns the expected value, etc. To achieve this, a different class 
(ClosedRange) would probably make more sense, because there's no need to make 
this decision at runtime.

2) The desire to change endIndex specifically. This is a no-go.

A.

_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to