English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
picking / marshaling to strings in ocaml-revision-stable way
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-05-31 (08:43)
From: Jacques Garrigue <garrigue@m...>
Subject: Re: [Caml-list] picking / marshaling to strings in ocaml-revision-stable way
From: "Luca de Alfaro" <luca@dealfaro.org>

> I need a way to convert  data structures to strings, in a way that is robust
> with respect to different versions of Ocaml.
> What I need to translate are mostly mixes of tuples, lists and variant
> types.  A typical example of data to marshal/pickle may look like:
> (3.4, [Move (4, 3, 5); Del (4, 2); Ins (4, 2)], "an example")
> I heard that the marshaling of the module Marshal is not robust with respect
> to changes in the version of Ocaml, and since I need to insert the data in a
> database for long-term use, this is a serious drawback. I need the
> marshaling and unmarshaling to be completely independent from the version of
> Ocaml, and from the particular architecture where the marshaling occurs.
> I could of course write my own solution, but I am wondering if there are any
> suitable modules  available that I could use.

AFAIK, ocaml's marshalling doesn't depend on the version, and is
architecture independent (there is only a limitation with integer
overflow when passing more than 31-bit integer values from 64-bit to
32-bit). So marshalling should be sufficient for your needs.
It is however sensitive to the data format you use (the types for your
data), and there is currently no way to verify that the type has not
changed between two versions of a program.

Jacques Garrigue      Nagoya University     garrigue at math.nagoya-u.ac.jp
		   <A HREF=http://www.math.nagoya-u.ac.jp/~garrigue/>JG</A>