From: "Jake Donham" <jake.donham@skydeck.com>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Long-term storage of values
Date: Fri, 29 Feb 2008 11:09:15 -0800 [thread overview]
Message-ID: <c7e4e9f0802291109q721f3068nc57b133799d2873c@mail.gmail.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0802291520190.8856@martin.ec.wink.com>
[-- Attachment #1: Type: text/plain, Size: 1943 bytes --]
On Fri, Feb 29, 2008 at 6:45 AM, Martin Jambon <martin.jambon@ens-lyon.org>
wrote:
> if we restrict the transition to a certain subset of operations, it can be
> possible to define a mapping using some Camlp4 tool such as Deriving
> (well, that's what I was told, assuming I interpreted correctly).
>
> For instance:
> - adding a record field: a default value is injected
> - removing a record field: just remove it
> - adding a variant: do nothing since it doesn't exist in the old data
> - changing a type arbitrarily (such as changing a type foo1 into foo2
> everywhere): provide a map function that would override the default map
> function for such nodes.
> - functional and abstract values: left as-is
>
We do this at Skydeck. We modified Deriving's Typeable module to expose the
structure of types, and we marshal values along with a version number (for
upgrades) and a type description from Typeable (so you get an error if you
change the type and forget to change the version number).
Our modified Typeable also has reflection functions so if you have a dynamic
(a value along with a Typeable.TypeRep) you can examine its parts
dynamically (implemented with Obj.magic). On top of that we have a generic
function for changing a value of one type into a value of another, as Martin
describes--we try to do the translation automatically as far as we can, and
provide a way to pass in mapping functions for particular types.
For the most part this works well. Compared to a SQL database it is very
nice to have the OCaml type system for data representation. The upgrade
mechanism is much safer than hand-coding SQL schema upgrades. On the other
hand, there are many things you get for free with a SQL db that you have to
do yourself: e.g. putting IDs on objects so you can refer to them
externally, easy hand-inspection of the data (it's annoying navigating big
structures in the top-level), to name a couple of small ones.
Jake
[-- Attachment #2: Type: text/html, Size: 2262 bytes --]
next prev parent reply other threads:[~2008-02-29 19:09 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-28 18:41 Dario Teixeira
2008-02-28 20:01 ` [Caml-list] " David MENTRE
2008-02-28 20:01 ` Thomas Fischbacher
2008-02-28 20:05 ` Mathias Kende
2008-02-28 22:09 ` Basile STARYNKEVITCH
2008-02-29 14:45 ` Martin Jambon
2008-02-29 19:09 ` Jake Donham [this message]
2008-02-28 23:42 ` Erik de Castro Lopo
2008-02-29 1:14 ` Brian Hurt
2008-02-29 7:40 ` Gabriel Kerneis
2008-02-29 10:19 ` Berke Durak
2008-02-29 18:05 ` Markus Mottl
2008-02-29 11:44 ` Richard Jones
2008-02-29 14:09 ` Brian Hurt
2008-03-01 14:15 ` Dario Teixeira
2008-03-20 21:03 ` Dario Teixeira
2008-03-20 21:32 ` Martin Jambon
2008-03-20 22:41 ` Dario Teixeira
2008-03-20 23:00 ` Martin Jambon
2008-03-21 14:01 ` Dario Teixeira
2008-03-21 14:28 ` Martin Jambon
2008-03-21 14:34 ` Martin Jambon
2008-03-20 21:42 ` Daniel Bünzli
2008-03-20 22:33 ` Dario Teixeira
2008-03-20 21:43 ` Gerd Stolpmann
2008-03-21 14:37 ` Dario Teixeira
2008-03-21 15:24 ` Richard Jones
2008-03-22 12:14 ` David MENTRE
2008-03-21 16:04 ` Gerd Stolpmann
2008-03-21 10:32 ` Berke Durak
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c7e4e9f0802291109q721f3068nc57b133799d2873c@mail.gmail.com \
--to=jake.donham@skydeck.com \
--cc=caml-list@yquem.inria.fr \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox