[swift-evolution] [Pitch] Removing the empty initialiser requirement from RangeReplaceableCollection

Haravikk swift-evolution at haravikk.me
Thu Jul 7 03:12:17 CDT 2016


> On 7 Jul 2016, at 06:50, Tim Vermeulen via swift-evolution <swift-evolution at swift.org> wrote:
> 
> This is a follow up from this swift-users thread: https://lists.swift.org/pipermail/swift-users/Week-of-Mon-20160704/002489.html
> 
> As it stands, RangeReplaceableCollection requires an implementation for init(), which is used in the default implementations of (as far as I can tell) init(_:), init(repeating:count:) and removeAll(keepingCapacity:). The latter of these methods should be implementable with removeSubrange(_:) instead.
> 
> I would like to propose to *remove* all three initialisers from this protocol, because it makes it impossible for some collections to conform to it that need extra data for its initialisation, but are otherwise perfectly capable of having arbitrary subranges replaced by elements from another collection. Those three initialisers could either move to a new protocol or simply not be part of any protocol.

+1 from me, if the ability to Self() initialise isn't absolutely required then these should be removed.


More information about the swift-evolution mailing list