From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id A5D65BB9C for ; Thu, 15 Sep 2005 18:39:48 +0200 (CEST) Received: from pih-relay06.plus.net (fuzznuts.plus.net [212.159.14.133] (may be forged)) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j8FGdmws008164 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for ; Thu, 15 Sep 2005 18:39:48 +0200 Received: from [80.229.56.224] (helo=chetara) by pih-relay06.plus.net with esmtp (Exim) id 1EFwm3-0003B7-0n for caml-list@yquem.inria.fr; Thu, 15 Sep 2005 17:39:47 +0100 From: Jon Harrop Organization: Flying Frog Consultancy Ltd. 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 User-Agent: KMail/1.7.2 References: <005201c5ba04$1797ff80$0100a8c0@mshome.net> <20050915151309.GA14311@kruemel> <005f01c5ba0d$2048a4a0$0100a8c0@mshome.net> In-Reply-To: <005f01c5ba0d$2048a4a0$0100a8c0@mshome.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline Message-Id: <200509151654.46707.jon@ffconsultancy.com> X-Miltered: at nez-perce with ID 4329A3D4.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 mutable:01 gava:01 toplevel:01 pointer:01 pointer:01 toplevel:01 debugging:01 ocaml:01 ocamlc:01 ocamlopt:01 metaocaml:01 ocaml:01 ...:98 ....:98 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 On Thursday 15 September 2005 16:49, Fr=E9d=E9ric 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 th= e=20 position of the code (the code itself is not available to Marshal). Clearly= ,=20 that pointer only makes sense in a compiled program and not in the top-leve= l,=20 e.g. when loading your marshalled value from a fresh top-level, your functi= on=20 does not exist. > Why is=20 > it not possible to load a special Marshal module for the toplevel ? I wou= ld > 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=20 compatible as possible. However, there are still discrepancies. Floating=20 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, may= be=20 metaocaml could work - you might be able to marshal "code" values instead o= f=20 closures. =2D-=20 Dr Jon D Harrop, Flying Frog Consultancy Ltd. Objective CAML for Scientists http://www.ffconsultancy.com/products/ocaml_for_scientists