[plt-scheme] hash-ref 'manipulating' mutable hash-tables?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Jul 2 07:57:38 EDT 2008

At Wed, 2 Jul 2008 10:10:11 +0100, "Stephen De Gabrielle" wrote:
> "Caveats concerning concurrent modification: A mutable hash table can
> be manipulated with hash-ref,"
> --  http://docs.plt-scheme.org/reference/hashtables.html
> 
> Is this right? How does hash-ref change a hash table?  (do mutable
> ht's do some sort of 'query optimisation' that I'm not aware of? if
> so; does this make them faster but less safe than immutable ht's?)

No, `hash-ref' doesn't mutate the table, at least not in the current
implementation. With respect to `hash-ref', that paragraph is meant
just to point out that reading via `hash-ref' uses a lock, so that it's
thread-safe (though not kill-safe) when other threads might mutate the
table.

Matthew



Posted on the users mailing list.