caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Marshal.to_string and mutable values
@ 2005-09-15 14:45 Frédéric Gava
  2005-09-15 15:13 ` [Caml-list] " Ingo Bormuth
  0 siblings, 1 reply; 5+ messages in thread
From: Frédéric Gava @ 2005-09-15 14:45 UTC (permalink / raw)
  To: caml-list

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



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

end of thread, other threads:[~2005-09-15 16:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-09-15 14:45 Marshal.to_string and mutable values Frédéric Gava
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

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