[swift-evolution] [Draft] Hasher & HashVisitable
Greg Parker
gparker at apple.com
Tue Mar 14 17:56:08 CDT 2017
> On Mar 14, 2017, at 12:01 PM, David Sweeris via swift-evolution <swift-evolution at swift.org> wrote:
>
> Are we committed to having `hashValue` always be an `Int`, or could it be an associated type like `(Int, Int, Int, Int)`? Seems like especially for something like a BigNum type or an Array, there might simple not be a reasonably efficient way to uniquely-ish represent 1024 bits with just 64 bits.
>
> (This kinda feels like one of those questions where the answer starts out with a variation on “you’re missing the point”)
This would lead to an implementation nightmare for hashing containers. Consider what the implementation of Dictionary<Any, String> would look like if any of its keys could have incompatible hash outputs.
--
Greg Parker gparker at apple.com <mailto:gparker at apple.com> Runtime Wrangler
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170314/19ad7aae/attachment.html>
More information about the swift-evolution
mailing list