[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Semantics of hash tables
- To: psz@mit.edu (Peter Szolovits)
- Subject: Re: Semantics of hash tables
- From: kab@cambridge.apple.com (Kim Barrett)
- Date: Mon, 29 May 95 16:17:17 EST
- Cc: info-mcl@digitool.com
- Sender: owner-info-mcl@digitool.com
> I am confused about whether the MCL implementation of EQUAL hash tables
> matches CLtL2, and (perhaps) about what the definition means. The question
> is what should happen if one hashes a data item and then changes
> (side-effects) it. In the particular instance I am working with (a
> midnight hack), I use an adjustable, fill-pointered vector of characters to
> build up strings, and I would then like to associate numbers with those
> strings in a hash table. The code goes something like this:
I think all the behaviour you found puzzling can be explained by the
fact that MCL hash tables have a cache of the last key/value pair
looked up (or stored?) and that the match against that cache is done
using eq.
The general rules for what side effects may be performed on hash table
keys are spelled out in ANSI-CL (section 18.1.2 Modifying Hash Table Keys).
Your example violates the rules specified in ANSI-CL.