I noticed that the new Collection index(_:offsetBy:) 
<http://swiftdoc.org/v3.0/protocol/Collection/#comment-func-index_offsetby_> 
does not define that negative offsets require a BidirectionalCollection. It 
also declares that negative offsets must complete in O( | offset | ) time. This 
differs from other methods such as distance(from:to:) 
<http://swiftdoc.org/v3.0/protocol/Collection/#comment-func-distance-from_to_>which
 indicates start <= end if not a BidirectionalCollection

This would preclude some data structures from strictly implementing the 
Collection protocol, such as singly-linked lists.

Would it be appropriate to indicate instead that BidirectionalCollection 
defines the negative offset behavior and negative offset performance constraint?

-DW
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to