[swift-evolution] [RFC] New collections model: collections advance indices

Joe Groff jgroff at apple.com
Tue Mar 8 11:52:25 CST 2016


> On Mar 7, 2016, at 5:25 PM, Dmitri Gribenko via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Hi,
> 
> What does everyone think about requiring indices to conform to
> Hashable, in addition to the existing requirements for Equatable and
> Comparable?
> 
> I don't think this should limit any viable collection designs, and yet
> might be useful, for example, to store indices in a set.

Is there a reason for Hashable to be distinct from Equatable at all? Every Equatable type can (badly) satisfy the requirements of Hashable with `return 0;`, if nothing else.

-Joe


More information about the swift-evolution mailing list