- Make RawRepresentable Codable abstracts distinguishable
- Make the UnboundedRange example a little more user friendly
- Correct the RangeReplaceableCollection example description
- Revise CaseIterable discussion
* Eradicate IndexDistance associated type, replacing with Int everywhere
* Consistently use Int for ExistentialCollection’s IndexDistance type.
* Fix test for IndexDistance removal
* Remove a handful of no-longer-needed explicit types
* Add compatibility shims for non-Int index distances
* Test compatibility shim
* Move IndexDistance typealias into the Collection protocol
* Refactor Indices and Slice to use conditional conformance
* Replace ReversedRandomAccessCollection with a conditional extension
* Refactor some types into struct+extensions
* Revise Slice documentation
* Fix test cases for adoption of conditional conformances.
* [RangeReplaceableCollection] Eliminate unnecessary slicing subscript operator.
* Add -enable-experimental-conditional-conformances to test.
* Gruesome workaround for crasher in MutableSlice tests
The RangeProtocol was a very weak and fragile abstraction because it
didn't specify the interpretation of the endpoints. To write a
non-trivial algorithm, one usually needed to consult that information.
The standard library code only actually worked correctly with half-open
and closed ranges (and didn't handle fully open ranges, for example).
The other two protocols, HalfOpenRangeProtocol and ClosedRangeProtocol,
were only used for code sharing, and present an ABI burden. We can use
gyb instead.
Before,
* We had a generic implementation of replaceSubrange that would
satisfy the protocol's last non-defaulted requirement
* A generic removeSubrange was in the protocol requirements needlessly
* The default implementation of that generic removeSubrange dispatched
to replaceSubrange instead of the non-generic removeSubrange, robbing
the model of optimization opportunities.
Now,
* There's one non-generic replaceSubrange that models must implement.
* The default implementation of removeSubrange uses replaceSubrange to
do its work.
* Models can implement the non-generic removeSubrange if they can
implement it faster than the default implementation.
* The generic removeSubrange uses the non-generic removeSubrange to do
its work.
We need a slice type for every combination of collection protocols, so
that a collection's SubSequence preserves all operations available on
the collection itself.
We need three index types, one for each traversal kind.