[pro] "fhash"

Daniel Weinreb dlw at google.com
Tue Jun 14 13:32:50 UTC 2011


Oh, yes, thank you very much for bringing up the issue of threads!

I have to mention that they are not thread-safe.  The CL definition does not
say whether hash tables are thread-safe since the CL definition has no
thread concept.  CCL hash tables are thread-safe.

Right now, they aren't CLOS instances at all.  It was sort of a little
pedagogical point of the exercise that an abstraction doesn't have to be a
CLOS object.  This is part of my whole claim that CLOS, unlike, say, CLU,
isn't trying to be an encapsulation mechanism.  If you want encapsulation,
that's what packages are for.  Java tries to both and ends up with baroque
rules about how "protected" interacts with "in different packages".

But Fare pointed out to me that being able to add generic functions
specialized on these would be a good thing.  This would mean making them use
CLOS not for encapsulation but for genericty.

So maybe there could be a subclass that did the locking.  Java's new
collection library also provides basic non-thread-safe collections, and then
thread-safe ones built upon them.  Thread-safety costs.  I really ought to
measure that, though.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/pro/attachments/20110614/ca27da6c/attachment.html>


More information about the pro mailing list