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=0.1 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail1-relais-roc.national.inria.fr (mail1-relais-roc.national.inria.fr [192.134.164.82]) by yquem.inria.fr (Postfix) with ESMTP id 3D151BBAF for ; Sat, 31 May 2008 10:43:38 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AnIBAHOsQEjAXQImiGdsb2JhbACSMQEBAQ8gmzM X-IronPort-AV: E=Sophos;i="4.27,570,1204498800"; d="scan'208";a="13006114" Received: from discorde.inria.fr ([192.93.2.38]) by mail1-smtp-roc.national.inria.fr with ESMTP; 31 May 2008 10:43:38 +0200 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id m4V8hbdk029313 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Sat, 31 May 2008 10:43:37 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: ApoEAOqsQEiCNhAB/2dsb2JhbACuFQ X-IronPort-AV: E=Sophos;i="4.27,570,1204498800"; d="scan'208";a="13298406" Received: from kurims.kurims.kyoto-u.ac.jp ([130.54.16.1]) by mail3-smtp-sop.national.inria.fr with ESMTP; 31 May 2008 10:43:35 +0200 Received: from localhost (orion [130.54.16.5]) by kurims.kurims.kyoto-u.ac.jp (8.13.8/8.13.8) with ESMTP id m4V8hROZ004878; Sat, 31 May 2008 17:43:27 +0900 (JST) Date: Sat, 31 May 2008 17:43:14 +0900 (JST) Message-Id: <20080531.174314.107716495.garrigue@math.nagoya-u.ac.jp> To: luca@dealfaro.org Cc: caml-list@inria.fr Subject: Re: [Caml-list] picking / marshaling to strings in ocaml-revision-stable way From: Jacques Garrigue In-Reply-To: <28fa90930805302343n18b98b17t72a22ea82539fc6f@mail.gmail.com> References: <28fa90930805302343n18b98b17t72a22ea82539fc6f@mail.gmail.com> X-Mailer: Mew version 4.2 on Emacs 22.1 / Mule 5.0 (SAKAKI) Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Miltered: at discorde with ID 48410FB9.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; marshaling:01 ocaml:01 marshaling:01 ocaml:01 unmarshaling:01 afaik:01 ocaml's:01 marshalling:01 marshalling:01 integer:01 integer:01 caml-list:01 tuples:01 marshal:01 marshal:01 From: "Luca de Alfaro" > I need a way to convert data structures to strings, in a way that is robust > with respect to different versions of Ocaml. > What I need to translate are mostly mixes of tuples, lists and variant > types. A typical example of data to marshal/pickle may look like: > > (3.4, [Move (4, 3, 5); Del (4, 2); Ins (4, 2)], "an example") > > I heard that the marshaling of the module Marshal is not robust with respect > to changes in the version of Ocaml, and since I need to insert the data in a > database for long-term use, this is a serious drawback. I need the > marshaling and unmarshaling to be completely independent from the version of > Ocaml, and from the particular architecture where the marshaling occurs. > I could of course write my own solution, but I am wondering if there are any > suitable modules available that I could use. AFAIK, ocaml's marshalling doesn't depend on the version, and is architecture independent (there is only a limitation with integer overflow when passing more than 31-bit integer values from 64-bit to 32-bit). So marshalling should be sufficient for your needs. It is however sensitive to the data format you use (the types for your data), and there is currently no way to verify that the type has not changed between two versions of a program. --------------------------------------------------------------------------- Jacques Garrigue Nagoya University garrigue at math.nagoya-u.ac.jp JG