[swift-users] Subtract a set of a subclass?

Dmitri Gribenko gribozavr at gmail.com
Fri Sep 2 21:12:51 CDT 2016

On Sat, Sep 3, 2016 at 4:47 AM, Zhao Xin via swift-users
<swift-users at swift.org> 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


(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/

More information about the swift-users mailing list