caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] Closures serialization and hash.
@ 2013-04-15  9:16 Christophe Raffalli
  2013-04-15 13:21 ` Stéphane Glondu
  2013-04-15 20:59 ` Gerd Stolpmann
  0 siblings, 2 replies; 3+ messages in thread
From: Christophe Raffalli @ 2013-04-15  9:16 UTC (permalink / raw)
  To: Caml List

[-- 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 --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-04-15 20:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-15  9:16 [Caml-list] Closures serialization and hash Christophe Raffalli
2013-04-15 13:21 ` Stéphane Glondu
2013-04-15 20:59 ` Gerd Stolpmann

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).