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 mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by yquem.inria.fr (Postfix) with ESMTP id C496EBBAF for ; Thu, 24 Sep 2009 13:26:31 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoEBAKn0ukpCbwQZkGdsb2JhbACbAAEBAQEJCQwHEwS6RwWEG4Fd X-IronPort-AV: E=Sophos;i="4.44,445,1249250400"; d="scan'208";a="34902325" Received: from out1.smtp.messagingengine.com ([66.111.4.25]) by mail3-smtp-sop.national.inria.fr with ESMTP; 24 Sep 2009 13:26:30 +0200 Received: from compute1.internal (compute1.internal [10.202.2.41]) by gateway1.messagingengine.com (Postfix) with ESMTP id D905571E94; Thu, 24 Sep 2009 07:26:28 -0400 (EDT) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by compute1.internal (MEProxy); Thu, 24 Sep 2009 07:26:28 -0400 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=messagingengine.com; h=message-id:date:from:mime-version:to:cc:subject:references:in-reply-to:content-type:content-transfer-encoding; s=smtpout; bh=YlLYa7liwC5Ixb28DUffBYeqY58=; b=Kz0n7qOYI8LLa3J2jfnNrASxWRkfsCmm5K3oWcCpTIywdGIslGiPMkEexPnxkC0YBDco8mfE4+/9G2ZksEwoRPuXpkinSC/uN+pAOyRCVHVDY9FA51d9fcABiAh3GJOBu7iwqEtIyhcjpheSqX3Ku34whXPPR91aaJIdCP5MCv4= X-Sasl-enc: npQGgBLJnr9SKyCH74HgAeUmlBj6QhSu+9E/F7M0F10Y 1253791588 Received: from [192.168.1.12] (ALyon-157-1-143-229.w90-42.abo.wanadoo.fr [90.42.150.229]) by mail.messagingengine.com (Postfix) with ESMTPSA id E0DE3130D7; Thu, 24 Sep 2009 07:26:27 -0400 (EDT) Message-ID: <4ABB5597.9010805@ens-lyon.org> Date: Thu, 24 Sep 2009 13:18:47 +0200 From: Martin Jambon User-Agent: Thunderbird 2.0.0.22 (X11/20090908) MIME-Version: 1.0 To: blue storm Cc: Mykola Stryebkov , David Allsopp , caml-list@yquem.inria.fr Subject: Re: [Caml-list] Generation of Java code from OCaml References: <46ACB6F9-FFAE-4C9C-9E46-21CA2E93434C@mykola.org> <20090923195713.GA12236@annexia.org> <001a01ca3ced$8ef58050$ace080f0$@metastack.com> <527cf6bc0909240245g11ce241cr16ac482003bb25f2@mail.gmail.com> In-Reply-To: <527cf6bc0909240245g11ce241cr16ac482003bb25f2@mail.gmail.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Spam: no; 0.00; ens-lyon:01 ocaml:01 patching:01 camlp:01 foo:01 foo:01 storm:98 wrote:01 caml-list:01 int:01 int:01 jambon:01 jambon:01 data:02 output:02 blue storm wrote: > In case it helps, below is a basic patch against json-static (SVN > trunk, 3.10 version). On your example it produces the following code : [...] Yes, patching the original code of json-static would work but it's not ideal. Maybe Deriving is a better choice (http://code.google.com/p/deriving/). I just say "maybe" because I've never used it. Or you can write your own camlp4 extension from scratch and find out how to use one of the predefined filters that would let you output only record-derived data. Note that if you're already using json-static but need to duplicate type definitions, you can do as follows: type foo = { bar : int } type json foo = predefined { bar : int } Martin -- http://mjambon.com/