caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Julien SIGNOLES <julien.signoles@cea.fr>
To: caml-list <caml-list@inria.fr>
Subject: Marshal.to_string and closures
Date: Thu, 22 Jan 2009 15:38:29 +0100	[thread overview]
Message-ID: <1232635109.7199.139.camel@localhost> (raw)

Hello,

I have a not-so-easy-to-reproduce case in which
=====
let tbl = Hashtbl.create 7
let f x = Hashtbl.find tbl x
let g b = Marshal.to_string (fun _ -> f b) [ Marshal.Closures ]
...
let _ = g ...
=====
may raise the exception
=====
Fatal error: exception Invalid_argument("output_value: abstract value
(Abstract)").
=====

If I wrote the above code like below, all is fine:
=====
let tbl = Hashtbl.create 7
let f x = Hashtbl.find tbl x;;
let g b = 
  let y = f b in
  Marshal.to_string (fun _ -> y) [ Marshal.Closures ]
...
let _ = g ...
=====

After debugging, that is the marshalling of the field 1 of the closure
(the environment?) which raises this exception.

Can someone confirm that such a behaviour is possible whenever the
environment contains a value tagged as abstract? Or in any other cases?

If that is a known behaviour for Marshal.to_string, maybe it could be
properly documented?

Best regards,
Julien Signoles


                 reply	other threads:[~2009-01-22 14:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1232635109.7199.139.camel@localhost \
    --to=julien.signoles@cea.fr \
    --cc=caml-list@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).