[swift-evolution] [RFC] New collections model: collections advance indices
pyry.jahkola at iki.fi
Tue Mar 8 05:46:18 CST 2016
> On 08 Mar 2016, at 03:25, Dmitri Gribenko via swift-evolution <swift-evolution at swift.org> wrote:
> What does everyone think about requiring indices to conform to
> Hashable, in addition to the existing requirements for Equatable and
Why impose such a restriction?
I think it's better to just make any concrete index types (e.g. DictionaryIndex<K,V>) in the standard library Hashable where possible. People are still free to constrain their algorithms to `C : CollectionType where C.Index : Hashable` whenever needed.
Besides, in the proposed design, is it really necessary to make Index also Comparable, or wouldn't Equatable be enough? Is it just a question of convenience and failing to find an example of and index type that's Equatable but not Comparable?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution