caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Frédéric Gava" <gava@univ-paris12.fr>
To: <caml-list@yquem.inria.fr>
Subject: Marshal.to_string and mutable values
Date: Thu, 15 Sep 2005 16:45:18 +0200	[thread overview]
Message-ID: <005201c5ba04$1797ff80$0100a8c0@mshome.net> (raw)

Hi all,

A personnal parallel application crash (but works before) and I am
very surprised to find that the pb is in Marshal.to_string. Take for
example:

let a = ref 0;;

(* no pb *)
Marshal.to_string a [Marshal.Closures];;
-: string = "..."

(* minor pb *)
Marshal.to_string (fun _ -> a) [Marshal.Closures];;
Exception: Invalid_argument "output_value: abstract value (outside heap)"
????
I do not use an abstract value here. But ok, there is peraps side effects
after the serialization of the function.

(* less minor pb *)
let f () =
 let b = ref 0 in b:=!b+1; 1 ;;

Marshal.to_string f [Marshal.Closures];;
Exception: Invalid_argument "output_value: abstract value (outside heap)"
????
I can save this function (with its closure). The reference is completely
local. For my purpose, a processor could not send to another processor a
function wich used some imperative features (for best complexity). That is
so bad...

Those examples comes from "Development of applications with OCaml" by
Chailloux and al. And they suppose to works... and in latest versions of
ocaml, they worked.

Anybody have an idea ? I suppose it is not a bug but I do not know why it is
a pb.

Frédéric Gava



             reply	other threads:[~2005-09-15 14:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-15 14:45 Frédéric Gava [this message]
2005-09-15 15:13 ` [Caml-list] " Ingo Bormuth
2005-09-15 15:49   ` Frédéric Gava
2005-09-15 15:54     ` Jon Harrop
2005-09-15 16:55       ` Mark Shinwell

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='005201c5ba04$1797ff80$0100a8c0@mshome.net' \
    --to=gava@univ-paris12.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).