identiyHash discussion

Tim Rowledge tim at sumeru.stanford.edu
Wed Dec 12 01:16:07 UTC 2001


Scott A Crosby wrote:
>

> 
> This was not what I meant.. See below:
Fair enough - your use of the phrase 'internal field' made me think you
were referring to header or hidden data.

[snip]
> Exactly. Extra hash bits are unlikely to be needed in practice. I fully
> agree, there should not be any VM changes... Fortunately, code like the
> following would work fine.
> 
> --------
> 
> FooClass>>new
>    super new.
>    hashCode := SmallInteger returnRandomInteger.
Well, not quite of course; more like 
	inst := super new.
	inst setHash: SmallInteger randomHashValue.
	^inst
unless you really wanted to use a class instance variable :-)

The practical problem with the idea of having a 'near-root' class that
provides the hashCode instvar is simply that you're then stuck if you
need a larger hash range for a class that already exists in some other
part of the class tree. One could add the same functionality in at any
class of course, but that has the same space costs as mentioned before
with a mostly-wasted instvar.

And I think I'd go even further than your point about refactoring
classed with >1000 methods. I say make MethodDictionaries limited to 512
entries so nobody can make classes that complex!

tim




More information about the Squeak-dev mailing list