Browse thread
Marshal.to_string and mutable values
- Frédéric_Gava
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: | 2005-09-15 (14:41) |
From: | Frédéric_Gava <gava@u...> |
Subject: | Marshal.to_string and mutable values |
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