It would be possible for a Hasher to return varying types, but then people 
might want the interface to support cryptographic hashing as well as variable 
length hashes (for things like HAMT)

-DW

> On Mar 14, 2017, at 4:56 PM, Greg Parker via swift-evolution 
> <[email protected]> wrote:
> 
> 
>> On Mar 14, 2017, at 12:01 PM, David Sweeris via swift-evolution 
>> <[email protected] <mailto:[email protected]>> 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     [email protected] <mailto:[email protected]>     Runtime 
> Wrangler
> 
> 
> _______________________________________________
> swift-evolution mailing list
> [email protected]
> https://lists.swift.org/mailman/listinfo/swift-evolution

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

Reply via email to