Version française
Home     About     Download     Resources     Contact us    
Browse thread
[Caml-list] Hashtbl.hash and Hashtbl.hash_param
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Blair Zajac <blair@o...>
Subject: Re: [Caml-list] Hashtbl.hash and Hashtbl.hash_param
Xavier Leroy wrote:
> 
> However, we need to think twice before changing the hashing function,
> because this would cause trouble to users that store hashtables in
> files using output_value/input_value: if the hash function changes
> before writing and reading, the hashtable read becomes unusable.
> 
> Hence, a request for OCaml users: if you use hashtables whose keys are
> structured data (not just strings or integers), *and* your program
> stores hashtables to files, *and* it's important for you that these
> persistent hashtables can be read back with future versions of OCaml,
> then please drop me a line.

I agree with the sentiment that OCaml should not be held up by backwards
compatibility.  But I think adding a version header to the files that
indicates the particular hashing function used would allow newer OCaml's
to read older files.  The newer OCaml's would only write the new version
of the files.  This would require that OCaml binary keep the old hash
functions around, but this could be made a configure option to enable
this feature.

I'm reminded of Perl's Storable module which serves much the same function
and had a method to read old Storable files but only write new versioned
files.

Best,
Blair

-- 
Blair Zajac <blair@orcaware.com>
Web and OS performance plots - http://www.orcaware.com/orca/
-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners