I'd like to discuss the relation between RangeReplaceableCollection and MutableCollection
MutableCollection is a Collection type that can { set } any element with subscript(position: Index). (and also { set } for subscript(range: Range<Index>))
RangeReplaceableCollection requires a function replaceRange(_:with:)
If a type conforms to RangeReplaceableCollection, it means any of its range can be replaced, that includes the situation to replace only one element.
So if some type conforms to RangeReplaceableCollection, it is sufficient to be a MutableCollection.
So I think the RangeReplaceableCollection should conforms to MutableCollection should inherits from MutableCollection.
I think you’ll get a better answer to your question on the ‘swift-dev’ list, actually.
Hope this helps,
- Tony
···
On Dec 2, 2017, at 9:08 AM, Cao, Jiannan via swift-corelibs-dev <swift-corelibs-dev@swift.org> wrote:
Hi everyone,
I'd like to discuss the relation between RangeReplaceableCollection and MutableCollection
MutableCollection is a Collection type that can { set } any element with subscript(position: Index). (and also { set } for subscript(range: Range<Index>))
RangeReplaceableCollection requires a function replaceRange(_:with:)
If a type conforms to RangeReplaceableCollection, it means any of its range can be replaced, that includes the situation to replace only one element.
So if some type conforms to RangeReplaceableCollection, it is sufficient to be a MutableCollection.
So I think the RangeReplaceableCollection should conforms to MutableCollection should inherits from MutableCollection.