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 mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 460D5BBAF for ; Thu, 24 Sep 2009 14:27:45 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoEBALkCu0pCbwQZkGdsb2JhbACbAQEBAQEJCQwHEwS7CwWEG4Fd X-IronPort-AV: E=Sophos;i="4.44,445,1249250400"; d="scan'208";a="47194586" Received: from out1.smtp.messagingengine.com ([66.111.4.25]) by mail4-smtp-sop.national.inria.fr with ESMTP; 24 Sep 2009 14:27:41 +0200 Received: from compute1.internal (compute1.internal [10.202.2.41]) by gateway1.messagingengine.com (Postfix) with ESMTP id 0C0637478C; Thu, 24 Sep 2009 08:27:40 -0400 (EDT) Received: from heartbeat2.messagingengine.com ([10.202.2.161]) by compute1.internal (MEProxy); Thu, 24 Sep 2009 08:27:40 -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=h3oREl6igfA7aAnpoBdW8LExc0o=; b=o4UKM/XYFoOoPbpFHhGPhTlF/orNRQaPhijWU4JO7lYWy+x/ZF7MVwoIEf8RkmxbnCq62nwnnUzu8ewRqMHFDdaY6ZGjCZ9omJxlw6zrC6N673OMC+cQkT4vzrsNtVvfFcjRfxHaIW11NNxYE3V14w/pakB5SJwYRsow3NVT56A= X-Sasl-enc: Gte4B6L0a0WY8qnohElg8C3u7RnzCzgfeNeQ0p3VlrOT 1253795259 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 05B6213149; Thu, 24 Sep 2009 08:27:38 -0400 (EDT) Message-ID: <4ABB63ED.1000402@ens-lyon.org> Date: Thu, 24 Sep 2009 14:19:57 +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> <4ABB5597.9010805@ens-lyon.org> <527cf6bc0909240502p1292ca1fs5890d3efeac49531@mail.gmail.com> In-Reply-To: <527cf6bc0909240502p1292ca1fs5890d3efeac49531@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 ens-lyon:01 patching:01 patching:01 def:01 camlp:01 camlp:01 storm:98 2009:98 wrote:01 wrote:01 caml-list:01 functions:01 jambon:01 blue storm wrote: > On Thu, Sep 24, 2009 at 1:18 PM, Martin Jambon > wrote: >> Yes, patching the original code of json-static would work but it's not ideal. > >>>From the example given, it seems that the original poster already uses > json-static. In that case, I think that reusing the code logic is a > good idea (coherent behaviour, etc.). I suppose that you dislike the > "patching" solution as it is not easily reusable (one cannot use the > upstream json-static anymore). Of course, the internals of json-static are much more likely to change than its user interface. This may however not be such a big problem here in practice. The problem is more that it's not compatible with other possible extensions of json-static provided by 3rd parties. > What about factorising json-static to allow adding arbitrary code > generators (represented as functions from (string * type_def) list to > a camlp4 Ast) at camlp4-time ? You would have a design similar to > type-conv, wich allows adding new generators without modifying > type-conv itself. Oh yes, there's type-conv too. I don't know the pros and cons of using either type-conv or deriving. If anyone knows, a brief comparison would be helpful. Martin -- http://mjambon.com/