[Issue 9771] Remove toHash from Object

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Mar 23 19:12:54 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9771



--- Comment #13 from Jonathan M Davis <jmdavisProg at gmx.com> 2013-03-23 19:12:53 PDT ---
> I see, so only when opEquals is default generated.

Yes. We could provide helper functions or mixins to make it easier to write
hash functions if you define opEquals (or on classes which won't have any kind
of default opEquals - let alone the useless one that they have now), but as
soon as opEquals has been defined by the programmer, it has to be up to the
programmer to define toHash correctly, as in order for hashing to work
correctly, every object which is equal must have the same hash. And if the
programmer defined opEquals, then the compiler will no longer have enough
information to define a toHash which guarantees that all equal objects will
have the same hash.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list