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.0 required=5.0 tests=none autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id D99B5BBCA for ; Fri, 21 Mar 2008 15:28:50 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ah0CAM5i40dCbwQZcmdsb2JhbACRDQEMAyiYYw X-IronPort-AV: E=Sophos;i="4.25,535,1199660400"; d="scan'208";a="24044597" Received: from out1.smtp.messagingengine.com ([66.111.4.25]) by mail4-smtp-sop.national.inria.fr with ESMTP; 21 Mar 2008 15:28:50 +0100 Received: from compute1.internal (compute1.internal [10.202.2.41]) by out1.messagingengine.com (Postfix) with ESMTP id F2E8EDA215; Fri, 21 Mar 2008 10:28:48 -0400 (EDT) Received: from heartbeat1.messagingengine.com ([10.202.2.160]) by compute1.internal (MEProxy); Fri, 21 Mar 2008 10:28:48 -0400 X-Sasl-enc: D7zPMRIcNrYXsPJKCyDaILUNPKfeoEgpOkPTKvSyx5iT 1206109728 Received: from [192.168.1.10] (ALyon-157-1-20-67.w81-251.abo.wanadoo.fr [81.251.179.67]) by mail.messagingengine.com (Postfix) with ESMTPSA id 1D28C6A4F; Fri, 21 Mar 2008 10:28:47 -0400 (EDT) Date: Fri, 21 Mar 2008 15:28:01 +0100 (CET) From: Martin Jambon X-X-Sender: martin@martin.ec.wink.com To: Dario Teixeira Cc: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Long-term storage of values In-Reply-To: <970998.33153.qm@web54604.mail.re2.yahoo.com> Message-ID: References: <970998.33153.qm@web54604.mail.re2.yahoo.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Spam: no; 0.00; ens-lyon:01 ocaml:01 val:01 val:01 parametrized:01 arrays:01 hash:01 syntax:01 ocaml:01 arrays:01 ajax:98 wrote:01 caml-list:01 functions:01 pervasive:01 On Fri, 21 Mar 2008, Dario Teixeira wrote: >> No JSON needs to be written by hand. >> Here's a simple example: >> >> type json point = { x : int; y : int } (* an OCaml record *) >> >> It creates the functions with the following signature: >> >> val json_of_point : point -> Json_type.t >> val point_of_json : Json_type.t -> point > > Hi, > > And thanks for the clarification, Martin. Okay then, this makes > json-static as convenient as Sexplib, and the strongest candidate > if human-readability is a requirement. It should also come in > very handy for browser/server communication (AJAX) using the > Ocsigen platform, for example. I have to say that json-static does not support parametrized types other than a few pervasive ones (lists, arrays, hash tables, options, ...). Like the other syntax extensions that deal with types it uses the type names to determine the JSON type to use, i.e. if 2 names are used to refer to the same OCaml type, they can use 2 different JSON representations. A common, predefined example is the "assoc" type, which is defined as follows: type 'a assoc = (string * 'a) assoc and would use a JSON object rather than a JSON array of arrays, which is common usage. Martin -- http://wink.com/profile/mjambon http://martin.jambon.free.fr