Bug 2729 – hash_t undocumented and unnecessary

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dlang.org
Product
D
Version
D2
Platform
x86
OS
Linux
Creation time
2009-03-11T23:56:00Z
Last change time
2015-06-09T01:21:08Z
Assigned to
bugzilla
Creator
jlquinn

Comments

Comment #0 by jlquinn — 2009-03-11T23:56:21Z
hash_t is listed as the output of *some* toHash() functions, without specifying what it is. The type is not defined, but the documentation expects programmers to generate it anyway. size_t is presumably the logical choice. Since hash_t is being created by programmers, rather than being an opaque type, I don't see where the value in having it is.
Comment #1 by jlquinn — 2009-03-12T00:02:43Z
Additionally, the requirements for user-defined hashing for structs and classes are inconsistent. First, struct requirements are listed as needing 2 members: const uint toHash() const int opCmp(Keytype*) Later, struct requirements are given again, but this time: hash_t toHash() bool opEquals(S) or bool opEquals(S*) int opCmp(S) or int opCmp(S*) Classes are supposed to match the 2nd set of functions. Shouldn't these functions be const? And S should be replaced by "Keytype" or the text above should state that S is a Keytype.
Comment #2 by bugzilla — 2009-03-12T23:56:46Z
The value in hash_t is the self-documenting nature of it. It being called size_t instead implies it contains a value with a different purpose. But the page does need updating as to the rest of your comments, and I'll fix it.
Comment #3 by bugzilla — 2009-04-01T13:55:45Z
Fixed DMD 2.027