[swift-evolution] Why doesn't Collection's SubSequence conform to Collection?

Charles Srstka cocoadev at charlessoft.com
Mon Feb 13 15:42:20 CST 2017

The following comment accompanies the declaration of the SubSequence associated type in the Collection protocol:

/// A sequence that represents a contiguous subrange of the collection's
/// elements.
/// This associated type appears as a requirement in the `Sequence`
/// protocol, but it is restated here with stricter constraints. In a
/// collection, the subsequence should also conform to `Collection`.
associatedtype SubSequence : IndexableBase, Sequence = Slice<Self>

The comments clearly state that the subsequence should conform to Collection, however, it is not declared as such. Why is this?


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170213/c39f9d35/attachment.html>

More information about the swift-evolution mailing list