[SR-1959] Use Bounds.Stride for Index on countable ranges #44568
Labels
affects ABI
Flag: Affects ABI
good first issue
Good for newcomers
improvement
standard library
Area: Standard library umbrella
swift evolution proposal needed
Flag → feature: A feature that warrants a Swift evolution proposal
Additional Detail from JIRA
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.
The text was updated successfully, but these errors were encountered: