On Sat, Sep 3, 2016 at 4:47 AM, Zhao Xin via swift-users
<[email protected]> wrote:
> Hi Jordan,
>
> Both you and I were wrong.
>
> My wrongness: Your so called principle should be applied here.
>
> Your wrongness: If you really want a different hash value, the parent
> equality function has to be conservative and say that the different types
> are different.

That's one way you can satisfy the rules, but not the only one.

Think about class clusters.  NSString has many subclasses that store
strings in different ways (for example, as Latin1 and UTF-16), but any
subclass instance compares equal to any other subclass instance that
carries the same character data, and also produces the same hash
value.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <[email protected]>*/
_______________________________________________
swift-users mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to