[SR-1959] Use Bounds.Stride for Index on countable ranges
#44,568 opened on Jul 1, 2016
Description
| Previous ID | SR-1959 |
| Radar | rdar://problem/26302563 |
| Original Reporter | @gribozavr |
| Type | Bug |
| Votes | 0 |
| Component/s | Standard Library |
| Labels | Bug, AffectsABI, StarterProposal, swift-evolution-proposal-needed |
| Assignee | None |
| Priority | Medium |
md5: 6a8b1ccf3e51e9239df2d35454f79393
Issue Description:
CountableRange collection conformance defines an Index type that conforms to Strideable. That is not the case for the CountableClosedRange, which makes the two ranges not interchangeable in all cases.
ClosedRangeIndex implementation uses an internal enum that makes Strideable conformance hard to implement.
The proposed solution is to use Bounds.Stride as Index on both CountableRange and CountableClosedRange.
-
It is proposed to use `Bound.Stride` as index for both countable ranges.
-
The only problem with that is that `SubSequence` of a countable range can no longer be the same type (as indices will not be interchangeable). [Why is this? Someone needs to reconstruct the logic chain.]
-
But it can be solved by using one of the existing slice types for `SubSequence`.
NOTE: Requires a swift-evolution proposal.