caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Christophe Raffalli <christophe.raffalli@univ-savoie.fr>
To: Caml List <caml-list@yquem.inria.fr>
Subject: [Caml-list] Closures serialization and hash.
Date: Mon, 15 Apr 2013 11:16:27 +0200	[thread overview]
Message-ID: <516BC56B.7090903@univ-savoie.fr> (raw)

[-- Attachment #1: Type: text/plain, Size: 2075 bytes --]


Hello,

The usual limitation of serialization and hashing of closures is sometimes painful, especially with
the current temptation of parallelisation. I am involved in two projects/sofwares that are impacted
by this: bindlib[1] (where data structure using bound variables uses closures) and Patoline[2]
(where documents using animation and compiled with the "Bin" driver contain closures).

There is a simple way out of this problem, at least for libraries where the function pointer
in closure can be predicted enough :

  - use a table associating function "names" (position in the .cmo, or the lambda-tree or anything
portable) to source code adresses. The function name should be portable across architecture and
distinct binary using common librairies.

 - (1) fill this table by calling a function "register_code_pointer : ('a -> 'b) -> unit"

 - (2) or even better offer a linking option to register all closures from some compilation unit.

With this, serialisation and hashing functions could use those "names" instead of addresses. Thus we
would have reproducible hash and portable serialization for registered functions in closure.

I will probably try this soon by adding custom version of Hash and Marshal to bindlib using (1) ...
But support from real OCaml giving (2) would be much better.

So my question is : are you ennoyed by this problem, and, if yes, would you be happy with the above
solutions.

Cheers,
Christophe

[1] http://www.lama.univ-savoie.fr/~raffalli/bindlib
[2] http://www.patoline.com

-- 
Christophe Raffalli
Universite de Savoie
Batiment Le Chablais, bureau 21
73376 Le Bourget-du-Lac Cedex

tel: (33) 4 79 75 81 03
fax: (33) 4 79 75 87 42
mail: Christophe.Raffalli@univ-savoie.fr
www: http://www.lama.univ-savoie.fr/~RAFFALLI
---------------------------------------------
IMPORTANT: this mail is signed using PGP/MIME
At least Enigmail/Mozilla, mutt or evolution
can check this signature. The public key is
stored on www.keyserver.net
---------------------------------------------




[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

             reply	other threads:[~2013-04-15  9:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-15  9:16 Christophe Raffalli [this message]
2013-04-15 13:21 ` Stéphane Glondu
2013-04-15 20:59 ` Gerd Stolpmann

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=516BC56B.7090903@univ-savoie.fr \
    --to=christophe.raffalli@univ-savoie.fr \
    --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;
as well as URLs for NNTP newsgroup(s).