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
Long-term storage of values
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Basile STARYNKEVITCH <basile@s...>
Subject: Re: [Caml-list] Long-term storage of values
Dario Teixeira wrote:
> Hi,
> Suppose I have a value of type Story.t, fairly complex in its definition.
> I wish to store this value in a DB (like Postgresql) for posterity.
> At the moment, I am storing in the DB the marshalled representation
> of the data; whenever I need to use it again in the Ocaml programme
> I simply fetch it from the DB and unmarshal it.
> This works fine; there is however one nagging problem: the marshalled
> representation is brittle.  If Story.t changes even slightly, I will
> no longer be able to retrieve values marshalled with the old version.

It is even theoretically a very difficult problem. There have been some 
publications by Cristal, Moscova, Gallium people at INRIA.

Assuming you have no abstract types, no objects, and no closures, and no 
polymorphisms i.e. that there is a *.ml source file containing all the 
type definitions. Then the types are composed by base types (int, 
string, ...), sums, records, and perhaps arrays.

Then you could consider what are the deltas on the type definition.

In a sum like type sumt = A of t1 | B of t2 | C
you might consider what happens when you remove let say B, or add let's 
say a choice | D of t3

In a record, consider likewise what happens when adding or removing a field.


The details are very complex (at least to me, who tried unsucessfully to 
work on this during my year at INRIA).

Maybe a semi-hand-crafted generator could help. Adding polymorphisms, 
closures, objects, abstract types is a big mess.

Good luck to you. Try to publish something.


Basile STARYNKEVITCH         http://starynkevitch.net/Basile/
email: basile<at>starynkevitch<dot>net mobile: +33 6 8501 2359
8, rue de la Faiencerie, 92340 Bourg La Reine, France
*** opinions {are only mines, sont seulement les miennes} ***