opHash??

Jonathan M Davis jmdavisProg at gmx.com
Tue Apr 10 21:12:22 PDT 2012


On Tuesday, April 10, 2012 21:10:31 H. S. Teoh wrote:
> On Tue, Apr 10, 2012 at 06:49:07PM -0700, Jonathan M Davis wrote:
> > On Tuesday, April 10, 2012 18:44:40 H. S. Teoh wrote:
> > > TDPL, p.117, last para:
> > > 	... For a user-defined type to be used as a key in an
> > > 	associative array, it must define two special methods, opHash
> > > 	and opCmp.
> > > 
> > > Really? I thought the convention was toHash (TDPL, p.205). So, which is
> > > it? Which *should* it be?
> > > 
> > > To me, it seems utterly arbitrary that classes should use toHash whereas
> > > non-class user-defined types should use opHash. Shouldn't we make it
> > > consistent across the board?
> > 
> > I expect that opHash was a mistake and that there should be an errata
> > for that line on page 117: http://erdani.com/tdpl/errata/
> 
> [...]
> 
> Actually, I looked, but it wasn't listed.

Yeah. I'm saying that it should probably be added. I'd be very surprised if it 
wasn't a mistake. The errata page isn't necessarily complete. It's just what 
people have caught and reported to Andrei.

- Jonathan M Davis


More information about the Digitalmars-d mailing list