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.2 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 mail2-relais-roc.national.inria.fr (mail2-relais-roc.national.inria.fr [192.134.164.83]) by yquem.inria.fr (Postfix) with ESMTP id 721FBBBAF for ; Sat, 31 May 2008 11:38:20 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AnIBAGO5QEjAXQIniGdsb2JhbACSMQEBAQ8glTuFcw X-IronPort-AV: E=Sophos;i="4.27,570,1204498800"; d="scan'208";a="11370818" Received: from concorde.inria.fr ([192.93.2.39]) by mail2-smtp-roc.national.inria.fr with ESMTP; 31 May 2008 11:38:20 +0200 Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id m4V9cJoC009845 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=OK) for ; Sat, 31 May 2008 11:38:20 +0200 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhICAM65QEjRVcbramdsb2JhbACSMQ0EAwYHDwWVNIVz X-IronPort-AV: E=Sophos;i="4.27,570,1204498800"; d="scan'208";a="13299474" Received: from rv-out-0506.google.com ([209.85.198.235]) by mail3-smtp-sop.national.inria.fr with ESMTP; 31 May 2008 11:38:18 +0200 Received: by rv-out-0506.google.com with SMTP id k40so170124rvb.57 for ; Sat, 31 May 2008 02:38:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=7NFXDL/AduhAfmXmbR9oWd7i9OpgcYDThV8cmBDv/UE=; b=CxGD45GZOtEO5GwhGcGA0jELaSSUcHKSrkmz7Eia4SE3iDLLr0+EFbx7KbHs6lljNBb+mN0RAg0yoMUARRmUAmt4a7nLE9DjhMF7gPX69UBPo2Mtj1Y6j9QplV89V248ly4NJmUWwBdjNR6RArOK1lmBDUpCnlgdDOj/lh2JVqY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=v3uJ9V+Ptzwy2gvYAOFutjJZoZfRCCqMRiPr9mdp3KCzkDMi0+d1+zR7hUMHqBHWhIRrtZA2Pc7TKWmEljsEk8dSoThgr7xrQVGlSif180LAkIoGop4e027K+Y1eqZhTJT5tFDbtU9onCCB2yLlBX8biH24AWfo9WBRjMVYtF7U= Received: by 10.140.128.11 with SMTP id a11mr3650280rvd.232.1212226697455; Sat, 31 May 2008 02:38:17 -0700 (PDT) Received: by 10.140.193.3 with HTTP; Sat, 31 May 2008 02:38:17 -0700 (PDT) Message-ID: Date: Sat, 31 May 2008 11:38:17 +0200 From: "Berke Durak" To: "Jacques Garrigue" Subject: Re: [Caml-list] picking / marshaling to strings in ocaml-revision-stable way Cc: luca@dealfaro.org, caml-list@inria.fr In-Reply-To: <20080531.174314.107716495.garrigue@math.nagoya-u.ac.jp> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <28fa90930805302343n18b98b17t72a22ea82539fc6f@mail.gmail.com> <20080531.174314.107716495.garrigue@math.nagoya-u.ac.jp> X-Miltered: at concorde with ID 48411C8B.000 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; berke:01 durak:01 berke:01 durak:01 marshaling:01 type-safe:01 segfault:01 segfault:01 hand-write:01 dependencies:01 ocaml:01 wikipedia:01 closures:01 caml-list:01 marshal:01 I second Luca's suggestion to use Sexplib. At the very least, use a plaintext format. Don't use Marshal for long-term storage of values. Avoid it if you can. Been there, done that. Why? (1) Not type-safe. Translation: your program *wil segfault* and you won't know why. (2) Not human-readable nor editable. (3) Not future-proof. What happens if you change your type definition? Your program will segfault. So you'll have to migrate your data. But how? You'll have to find the exact revision used to generate the binary data. Good luck with that. Did you put a revision number in your data? Are you sure it was up-to-date? Then you'll have to hand-write a converter that uses type declarations from the old and the new modules. I hope your dependencies are not too complex. Not fun *at all*. However, there are some situations where Marshal is appropriate : (1) Your data is not acyclic, contains closures, or needs sharing to be compact enough. Sexplib doesn't handle these. (2) The data won't live long anyway. As in: you're doing IPC between known versions of Ocaml programs. (3) You desperately need speed. As in: you're processing 200GB of Wikipedia data. Then I can understand. -- Berke Durak