[swift-dev] [Proposal] RangeReplaceableCollection should inherits from MutableCollection

Cao, Jiannan frogcjn at 163.com
Sat Dec 2 14:31:03 CST 2017

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.


More information about the swift-dev mailing list