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.3 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 DEFC9BBCA for ; Thu, 20 Mar 2008 22:03:38 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AlIBAONt4kfOvjGsfGdsb2JhbACRBAEBCwUCBwcWmiI X-IronPort-AV: E=Sophos;i="4.25,533,1199660400"; d="scan'208";a="8632144" Received: from web54602.mail.re2.yahoo.com ([206.190.49.172]) by mail2-smtp-roc.national.inria.fr with SMTP; 20 Mar 2008 22:03:38 +0100 Received: (qmail 53056 invoked by uid 60001); 20 Mar 2008 21:03:37 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=sTNKa2cBcJcd753VFc6bQ05HUDGfqo1IfRsOcEWppDWa6KZCmo81BRvdc3JWgjTvVslqSw/xCPOtislT2GXWgq2nD75bh8rdLBy0gzFHSdjC2mX9hQ447uru1fHpfL/U+AG4xlkkphY9RdIWz8Us1RFA9Xjw5vLxrSLy0h4Wa0U=; X-YMail-OSG: QH8q9TMVM1m3kmqJrhXFnjlK.0MnpuGjpjHpFSANOh4viR5y1NMYf4DEIG2rcP_QLIWHPnJDb0Q71CU0iRuVR4u_MH685qddE5HYuEB4LOJG.fCDPiq9Zt4p9c1H1_RnU6mfyuiUcpeckBjhCV6k7uSVew-- Received: from [85.244.12.183] by web54602.mail.re2.yahoo.com via HTTP; Thu, 20 Mar 2008 21:03:37 GMT Date: Thu, 20 Mar 2008 21:03:37 +0000 (GMT) From: Dario Teixeira Subject: Re: [Caml-list] Long-term storage of values To: caml-list@yquem.inria.fr In-Reply-To: <191751.36007.qm@web54607.mail.re2.yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Message-ID: <606612.52588.qm@web54602.mail.re2.yahoo.com> X-Spam: no; 0.00; ocaml:01 ocaml:01 recursive:01 syntax:01 camlp:01 syntax:01 appending:01 sexp:01 ocamlduce:01 verbose:01 combinator:01 berke:01 durak:01 recursive:01 cheers:01 Hi, Some weeks ago I asked in the list about solutions for the long-term storage of values in Ocaml. I was looking for a solution that was not quite as brittle as the Marshal module, while still maintaining reasonable performance and being able to deal with Ocaml types in all their glory (recursive structures, etc). Thanks for all your replies -- I got plenty of ideas and found out about new libraries I didn't know existed. After some experimenting, I settled for Sexplib; the main reason being the syntax extension that automatically takes care of writing the (de)serialising functions. However, if your requirements are different, you may find that another solution might be more suitable. Here's a brief summary of the main options I looked into: (let me know if there are others!) - S-expressions using Sexplib. It has the advantage of being quite fast, compact, and still human-readable-ish (if you like parentheses). Moreover, the Camlp4 syntax extension makes the creation of (de)serialising functions as straightforward as appending "with sexp" to type definitions. - Config_file. A strong contender if proper human-readability is a requirement (it is far more readable than Sexplib, for example). As far as I can tell, you still need to manually create the (de)serialising functions for complex types, though. Also, my guess is that the slightly more complex syntax will make it slower than Sexplib. - JSON. Possibly close to Config_file in terms of effort and speed. Has the same advantage of being very human-friendly, and the additional advantage of having quickly become a popular interchange format (you'll find libraries for almost any language out there). - XML. Though Ocamlduce makes XML easier to deal with, the only advantage I see in XML is its ubiquity. The format is verbose, not all that human-friendly, and you still need to manually create the (de)serialising functions. - XDR. Though I have fond memories of using XDR with C (in a different life), I have no experience with it in Ocaml. Though it should be very fast, you also need to manually create the (de)serialising functions. - The I/O combinator library by Berke Durak. Seems similar to XDR in terms of effort required. Does it still not support recursive structures? That is a common requirement. Cheers, Dario Teixeira ___________________________________________________________ Rise to the challenge for Sport Relief with Yahoo! For Good http://uk.promotions.yahoo.com/forgood/