I thought this was it, but none of the default implementations of 
RangeReplaceableCollection seem to use this empty initialiser (except for the 
two other initialisers and `removeAll(keepingCapacity:)`, the latter of which 
can be implemented using `removeSubrange(_:)` instead). This makes me wonder 
whether this is the right protocol to put an empty initialiser.

> On 6 Jul 2016, at 20:12, Tino Heth <2...@gmx.de> wrote:
> 
> Hi there,
> 
>> The requirement of the empty initialiser makes it impossible to have a 
>> collection conform to this protocol that needs additional data for its 
>> initialisation.
> But if there is no guarantee for an empty initializer, you always need a 
> piece of data to create an instance — and when you do heavy "metaprogramming" 
> (generics, protocols…), it can become very hard to supply this additional 
> data.
> In those situations, it is very valuable when you can create an object out of 
> thin air…
> 
> Tino

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to