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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id 75FF4BBCA for ; Fri, 21 Mar 2008 15:35:07 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ah0CAHNk40dCbwQZcmdsb2JhbACRDQEMAyiYXQ X-IronPort-AV: E=Sophos;i="4.25,535,1199660400"; d="scan'208";a="10533910" Received: from out1.smtp.messagingengine.com ([66.111.4.25]) by mail3-smtp-sop.national.inria.fr with ESMTP; 21 Mar 2008 15:35:06 +0100 Received: from compute1.internal (compute1.internal [10.202.2.41]) by out1.messagingengine.com (Postfix) with ESMTP id 50D34D9236; Fri, 21 Mar 2008 10:35:05 -0400 (EDT) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by compute1.internal (MEProxy); Fri, 21 Mar 2008 10:35:05 -0400 X-Sasl-enc: N7LULsgKx8AjjK37TPwaXHGc3NsfV2hiwpvopMkcYvGP 1206110104 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 8E63E2E2EC; Fri, 21 Mar 2008 10:35:04 -0400 (EDT) Date: Fri, 21 Mar 2008 15:34:14 +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: 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 wrote:01 caml-list:01 functions:01 On Fri, 21 Mar 2008, Martin Jambon wrote: > 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 erratum: type 'a assoc = (string * 'a) list > 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