From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: ** X-Spam-Status: No, score=2.6 required=5.0 tests=AWL,RCVD_NUMERIC_HELO, SPF_SOFTFAIL,UNPARSEABLE_RELAY autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 0F0D3BBAF for ; Thu, 22 Jan 2009 15:37:52 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AskFAJ0TeEmEqOABh2dsb2JhbACJEopOHAEBAQoLCBpNtiyFc4Id X-IronPort-AV: E=Sophos;i="4.37,307,1231110000"; d="scan'208";a="21881151" Received: from oxalide-out.extra.cea.fr ([132.168.224.1]) by mail3-smtp-sop.national.inria.fr with ESMTP; 22 Jan 2009 15:37:52 +0100 Received: from nephilia.intra.cea.fr (nephilia.intra.cea.fr [132.166.88.33]) by oxalide.extra.cea.fr (8.14.2/8.14.2/CEAnet-Internet-out-1.2) with ESMTP id n0MEaHYX012396 for ; Thu, 22 Jan 2009 15:36:17 +0100 Received: from muguet2.intra.cea.fr (muguet2.intra.cea.fr [132.166.192.7]) by nephilia.intra.cea.fr (8.13.8/8.13.8) with ESMTP id n0MEboNf015156 for ; Thu, 22 Jan 2009 15:37:51 +0100 (envelope-from julien.signoles@cea.fr) Received: from levau.intra.cea.fr (levau.intra.cea.fr [132.166.88.52]) by muguet2.intra.cea.fr (8.13.8/8.13.8/CEAnet-Intranet-out-1.1) with ESMTP id n0MEbo95031526 for ; Thu, 22 Jan 2009 15:37:50 +0100 Received: from LAXA.intra.cea.fr ([132.166.64.44]) by levau.intra.cea.fr with Microsoft SMTPSVC(6.0.3790.3959); Thu, 22 Jan 2009 15:37:50 +0100 Received: from 132.166.135.80 ([132.166.135.80]) by LAXA.intra.cea.fr ([132.166.64.53]) with Microsoft Exchange Server HTTP-DAV ; Thu, 22 Jan 2009 14:37:50 +0000 Received: from is005140 by LAXA.intra.cea.fr; 22 Jan 2009 15:38:29 +0100 Subject: Marshal.to_string and closures From: Julien SIGNOLES To: caml-list Content-Type: text/plain Content-Transfer-Encoding: 7bit Organization: CEA LIST Date: Thu, 22 Jan 2009 15:38:29 +0100 Message-Id: <1232635109.7199.139.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.22.3.1 X-OriginalArrivalTime: 22 Jan 2009 14:37:50.0297 (UTC) FILETIME=[00458490:01C97C9F] X-Spam: no; 0.00; signoles:01 signoles:01 hashtbl:01 hashtbl:01 marshalling:01 closures:01 closures:01 wrote:01 abstract:01 abstract:01 exception:01 exception:01 cea:01 marshal:01 marshal:01 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