caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Jon Harrop <jon@ffconsultancy.com>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Marshal.to_string and mutable values
Date: Thu, 15 Sep 2005 16:54:46 +0100	[thread overview]
Message-ID: <200509151654.46707.jon@ffconsultancy.com> (raw)
In-Reply-To: <005f01c5ba0d$2048a4a0$0100a8c0@mshome.net>

On Thursday 15 September 2005 16:49, Frédéric Gava wrote:
> ok. Excuse me for this stupid question (but the error messages are not
> clear). My true question is: why does it not work in the toplevel ?

Marshal probably marshals the environment of a closure with a pointer to the 
position of the code (the code itself is not available to Marshal). Clearly, 
that pointer only makes sense in a compiled program and not in the top-level, 
e.g. when loading your marshalled value from a fresh top-level, your function 
does not exist.

> Why is 
> it not possible to load a special Marshal module for the toplevel ? I would
> be nice to have your program (in my case, parallel programs) that works
> in the toplevel (for debugging) and as compiled programs.

Yes. INRIA have put a lot of effort into making ocaml, ocamlc and ocamlopt as 
compatible as possible. However, there are still discrepancies. Floating 
point arithmetic is another one.

> To debug a program, I used many times the toplevel. And in my case, I need
> to  serialized functions. In the compiled program, it works but not in the
> toplevel. But before have a program which works
> I need the toplevel...paradox....

Can you get rid of the closures in your Marshalled value? Failing that, maybe 
metaocaml could work - you might be able to marshal "code" values instead of 
closures.

-- 
Dr Jon D Harrop, Flying Frog Consultancy Ltd.
Objective CAML for Scientists
http://www.ffconsultancy.com/products/ocaml_for_scientists


  reply	other threads:[~2005-09-15 16:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-09-15 14:45 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 [this message]
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=200509151654.46707.jon@ffconsultancy.com \
    --to=jon@ffconsultancy.com \
    --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).