caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Markus Mottl" <markus.mottl@gmail.com>
To: "Berke Durak" <berke.durak@exalead.com>
Cc: "Gabriel Kerneis" <kerneis@enst.fr>,
	"Caml-list List" <caml-list@inria.fr>
Subject: Re: [Caml-list] Long-term storage of values
Date: Fri, 29 Feb 2008 13:05:54 -0500	[thread overview]
Message-ID: <f8560b80802291005t4f006339r3aabafe00296faf4@mail.gmail.com> (raw)
In-Reply-To: <47C7DC1D.9030600@exalead.com>

On Fri, Feb 29, 2008 at 5:19 AM, Berke Durak <berke.durak@exalead.com> wrote:
>  One major drawback of IO is that it does not handle sharing or recursive
>  structures.  And I know of no efficient, type-safe way of handling those,
>  especially if you don't want the serializer to add extra sharing (for instance
>  if you have distinct mutable records with the same contents)

It shouldn't be too hard to write a macro that generates code for
checking whether data marshalled out using the standard marshalling
function conforms to a type specification even in the presence of
shared or cyclic values.  You just need to store a type identifier in
an array for every structured value you encounter.  Whenever there is
a backreference in the marshalled data, you check whether the type
denoted by the identifier for the previously seen value unifies with
what you expect at the current position.  This should be sufficiently
efficient.  If this type checking succeeds, it should be safe to
unmarshal the data using the standard functions.

Regards,
Markus

-- 
Markus Mottl        http://www.ocaml.info        markus.mottl@gmail.com


  reply	other threads:[~2008-02-29 18:06 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
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 [this message]
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=f8560b80802291005t4f006339r3aabafe00296faf4@mail.gmail.com \
    --to=markus.mottl@gmail.com \
    --cc=berke.durak@exalead.com \
    --cc=caml-list@inria.fr \
    --cc=kerneis@enst.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;
as well as URLs for NNTP newsgroup(s).