
On 28 September 2004 12:49, George Russell wrote:
Einar wrote (snipped):
I recently noticed that Data.HashTable silently accepts duplicate keys and keeps all the values. This is very counterintuitive from the interface and makes updating a hashtable quite tedious (lookup + delete + insert).
Gosh, I'm glad *someone* told me of this bizarre behaviour. Why on earth hash tables should mimic association lists of all things is a mystery to me. (Should GHC also insert delay loops to simulate their poor performance?)
Sigh, off I go to fix my code. Just as well I only use hash tables in one place.
Making insert do delete+insert is pretty inefficient if you know that the key isn't in the table. Providing update (==delete+insert) seems a reasonable solution, no? Cheers, Simon