[swift-users] Why does RangeReplaceableCollection require an empty initialiser?
2th at gmx.de
Wed Jul 6 13:12:34 CDT 2016
> 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…
More information about the swift-users