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=AWL,HTML_MESSAGE 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 F338EBC37 for ; Sat, 3 Oct 2009 20:29:27 +0200 (CEST) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AtIEAMo0x0pZELGa/2dsb2JhbACBUVQvzxaEKgQ X-IronPort-AV: E=Sophos;i="4.44,500,1249250400"; d="scan'208,217";a="34120783" Received: from recoil.dh.bytemark.co.uk (HELO dark.recoil.org) ([89.16.177.154]) by mail2-smtp-roc.national.inria.fr with SMTP; 03 Oct 2009 20:29:27 +0200 Received: (qmail 31535 invoked by uid 634); 3 Oct 2009 18:29:27 -0000 Received: from 94-194-206-35.zone8.bethere.co.uk (HELO sneak.config) (94.194.206.35) (smtp-auth username remote@recoil.org, mechanism cram-md5) by dark.recoil.org (qpsmtpd/0.83) with ESMTPA; Sat, 03 Oct 2009 19:29:27 +0100 Subject: Re: [Caml-list] Generation of Java code from OCaml Mime-Version: 1.0 (Apple Message framework v1076) Content-Type: multipart/alternative; boundary=Apple-Mail-4--738026489 From: Anil Madhavapeddy In-Reply-To: <527cf6bc0910031027p2ef071bbue89260810fc337b6@mail.gmail.com> Date: Sat, 3 Oct 2009 19:29:23 +0100 Cc: Martin Jambon , caml-list@yquem.inria.fr Message-Id: <670A1DC9-9795-4DD0-82E5-FA97D837A813@recoil.org> 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> <4ABB63ED.1000402@ens-lyon.org> <205DBD56-053A-48B6-B37F-230FB49B7499@recoil.org> <527cf6bc0910031027p2ef071bbue89260810fc337b6@mail.gmail.com> To: blue storm X-Mailer: Apple Mail (2.1076) X-Virus-Checked: Checked by ClamAV on dark.recoil.org X-Spam: no; 0.00; ocaml:01 anil:01 anil:01 hashtbl:01 ctyp:01 ctyp:01 failwith:01 hashtbl:01 failwith:01 storm:98 2009:98 git:98 storm:98 2009:98 git:98 --Apple-Mail-4--738026489 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii; format=flowed; delsp=yes On 3 Oct 2009, at 18:27, blue storm wrote: > On Sat, Oct 3, 2009 at 2:16 PM, Anil Madhavapeddy > wrote: >> The only thing I haven't quite worked out yet is the quotation to >> pattern-match type applications to detect things like "(string, unit) >> Hashtbl.t" the way the current json-static does via the grammar >> extension. >> -anil > > Below are two patches (from `git log -u`) adding the relevant > features. > (snip) > - > + | <:ctyp< assoc $t$ >> as assoc -> > + (match t with > + | <:ctyp< (string * $t$) >> -> Assoc (_loc, process_td _loc t) > + | _ -> failwith "must be of the form (string * ...) assoc") > | <:ctyp< < $cs$ > >> -> Object (process_fields _loc cs) > | <:ctyp< { $cs$ } >> -> Record (process_fields _loc cs) Thanks; my goal is to avoid putting in special types into type-conv generators though ('assoc' here), so they can be used alongside other generators too. It seems reasonable to just special-case "Hashtbl.t string $t$" and "list ( string * $t$ )", since JSON objects must have a string as the key. I've pushed a patch which does that to my tree, along with some of your other changes. -anil --Apple-Mail-4--738026489 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=us-ascii
On = Sat, Oct 3, 2009 at 2:16 PM, Anil Madhavapeddy <anil@recoil.org> = wrote:
The only thing I haven't quite = worked out yet is the quotation to
pattern-match type applications to detect things like = "(string, unit)
Hashtbl.t" the = way the current json-static does via the grammar = extension.
-anil

Below are two patches (from `git = log -u`) adding the relevant features.

(snip)
-
+ | <:ctyp< assoc $t$ >> as assoc = ->
+   (match t with
+ =      | <:ctyp< (string * $t$) >> = -> Assoc (_loc, process_td _loc t)
+ =      | _ -> failwith "must be of the form = (string * ...) assoc")
 | <:ctyp< < $cs$ > >> = -> Object (process_fields _loc cs)
 | <:ctyp< { $cs$ } = >> -> Record (process_fields _loc = cs)

Thanks; my goal is to avoid = putting in special types into type-conv generators though ('assoc' = here), so they can be used alongside other generators = too.

It seems reasonable to just special-case = "Hashtbl.t string $t$" and "list ( string * $t$ )", since JSON objects = must have a string as the key. I've pushed a patch which does that to my = tree, along with some of your other = changes.

-anil
= --Apple-Mail-4--738026489--