[mercury-users] Inst problem with hash tables

Paul Bone pbone at csse.unimelb.edu.au
Tue Sep 23 16:10:13 AEST 2008


On Tue, Sep 23, 2008 at 03:14:23PM +1000, Ralph Becket wrote:
> Andrea Bini, Monday, 22 September 2008:
> >    It is compiled with no errors but when run it reports the error
> >    "Invalid ht.dat". I think that the problem resides in the high-order
> >    term in the hash table structure. It is written to disk just as the
> >    string '<<predicate>>'.
> >    How can I fix this problem?
> 
> Ah, of course!  The short answer is: you can't, because there is no
> portable way of writing out bits of code (which is what the higher order
> term is).
> 
> In this case I withdraw my objection to Paul's suggestion.  The solution
> has to be something like that: convert the hash_table into an
> assoc_list and use that as your on-disc representation.  Sorry for
> misleading you.

The extra cost of re-computing the hashes is probably much smaller than
reading from the disk.

IMHO, it's also a bad idea to write out hashed values (except when the
hashing algorithm is clearly defined), since the hashing algorithm may
be changed between program versions, or may not be portable.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mercurylang.org/archives/users/attachments/20080923/20504e8d/attachment.sig>


More information about the users mailing list