[cl-store-devel] hash-table serialization with custom hashing functions

Chris Dean ctdean at sokitomi.com
Tue Apr 21 22:37:37 UTC 2009


How should I handle hash-tables with custom hashing functions?  Some
Lisps have an extension to make-hash-table to allow for a custom hashing
function:

  (make-hash-table :test 'my-equal :hash-function 'my-hashing)

How should we handle serialization for these objects?  Right now we
write out the hash-table-test but not the hash-function.  This causes
bad behaviors (or an error) on some Lisps when I restore the hash-table.
The problem (as I see it) is that there is no standard way to get the
hash-function.

I was about to try and convince the Clozure folks to add a
hash-table-hash-function and then send a patch to cl-store that used
that function for Clozure, when I realized what a bad idea that is.  I'd
rather be able to fix this problem once for all CL implementations.

So what do you think?  Should we add a registry of some sort so that we
know that restoring a hash-table with a hash-table-test of X should
always use a hash-function of Y?

Cheers,
Chris Dean




More information about the cl-store-devel mailing list