Incongruent hash

Eliot & Linda elcm at pacbell.net
Mon Feb 9 17:10:01 UTC 1998


Travis or Kerrin Griggs wrote:
> 
> Eliot & Linda wrote:
> 
> > I shouldn't have spoken so soon.  I've just noticed that in VisualWorks
> >         1 at 1 = 1
> > but
> >         (1 at 1) hash ~= 1 hash
> > :(
> >
> > One more thing to fix...
> 
> So, how are you going to fix it? I find use in being able to perform the
> four basic math ops between Points and simple Numbers, but I have never
> had reason to find out if 1 at 1 was equal to 1, and not only that, I don't
> think it should be. This (again) seems like we're playing slave to a
> flawed class heirarchy (not that I have any great alternatives to offer).

I don't think it is anything to do with a flawed class hierarchy. 
Smalltalk's behaviour is independent of the class hierarchy (provided
one removes isKindOf:).  Its to do with the coercion framework between
numbers and points.  It seems reasonable to be able to do
    1 at 2 * 3

Then one has to weigh surprise against complexity in extending this to
    1 at 2 = 1

Since its certainly possible to implement an acceptably efficient hash
that preserves n asPoint hash = n hash and gives good distribution for
points with x ~= y I would choose least surprise.

_______________,,,^..^,,,_______________
Eliot





More information about the Squeak-dev mailing list