bugs? hash and the debugger.

ohshima at is.titech.ac.jp ohshima at is.titech.ac.jp
Mon Dec 13 11:35:22 UTC 1999


  Hi,

> Hash should be a fast function, since it is often used for
> quick rejection of potentially long comparisons.  How about
> making the default collection hash be order independent, so
> there's no need to sort as part of hashing, and perhaps fall
> back to a simple function of size if it is greater than,
> say, 10.

  Yes.  Simply xor'ing the elements' hash values seems
better.

  At first, I thought the hash values of Sets should be
distributed widely even if the elements of the Sets are
similar.  But it doesn't have to.

> hash
> 	| hash |
> 	hash := self species hash.
> 	self size > 10 ifTrue: [^ hash + size].
> 	self do: [:elem | hash := hash bitXor: elem hash].
> 	^ hash.
> 
> Would this answer your needs?

  Precisely speaking, this is not my needs:-) but it seems
reasonable implementation.

  Thank you.

  -- Yoshiki





More information about the Squeak-dev mailing list