> For all of you who failed to reproduce that behaviour, perform a garbage
> collection in between. For me it did not work otherwise.
>
>
> (display (hashq 'position 5)) (newline) --> 2
> (gc)
> (display (hashq 'position 5)) (newline) --> 0
You're right --- hashq uses the object's address as the hash value.
Since the garbage collector disposes of the symbol `position' between
the two calls to hashq, hashq is actually seeing two unrelated
objects.
By definition, a garbage collector is only supposed to discard objects
if it can prove that doing so will have no effect on the ongoing
computation. The problem here is that, using hashq, you could
potentially watch the address of every object in the system, so
there's nothing the GC can do without being `caught'. So in theory,
the presence of hashq means that the GC can never free anything.
As you suggested, I think it's better to refine the definition of
hashq a bit than to forbid the recycling of objects. :)
What kinds of troubles is this causing you, specifically? I'm having
a hard time imagining a context where you'd care that a symbol's hash
value has changed if you haven't kept any references to the symbol
itself.