[Issue 9771] Remove toHash from Object

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Mar 22 19:09:42 PDT 2013


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



--- Comment #3 from Jonathan M Davis <jmdavisProg at gmx.com> 2013-03-22 19:09:41 PDT ---
> This probably can't be implemented until we replace AA's with a library
> template

I figured that that was probably the case, and that will certainly slow this
down, but it still needs to be done.

> Once we have the library type, though, we can probably make use of UFCS to
> provide default implementations of toHash for all types.

I'd be very much against providing a UFCS toHash function which used
compile-time reflection to figure out how to generate a hash for an arbitrary
object. That's just begging for trouble, particularly since the behavior of
opEquals and toHash need to match. They need to be controlled by the object
itself and not 3rd party code. Providing a mixin to which does that would
definitely be useful for avoiding boilerplate, but then it's properly under the
control of the person writing the class or struct.

But providing toHash functions for built-in types via CTFE would certainly be
good.

-- 
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