caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Anil Madhavapeddy <anil@recoil.org>
To: blue storm <bluestorm.dylc@gmail.com>
Cc: Martin Jambon <martin.jambon@ens-lyon.org>, caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Generation of Java code from OCaml
Date: Sat, 3 Oct 2009 19:29:23 +0100	[thread overview]
Message-ID: <670A1DC9-9795-4DD0-82E5-FA97D837A813@recoil.org> (raw)
In-Reply-To: <527cf6bc0910031027p2ef071bbue89260810fc337b6@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1174 bytes --]

On 3 Oct 2009, at 18:27, blue storm wrote:

> 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

[-- Attachment #2: Type: text/html, Size: 1959 bytes --]

  reply	other threads:[~2009-10-03 18:29 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-23 18:15 Mykola Stryebkov
2009-09-23 19:57 ` [Caml-list] " Richard Jones
2009-09-23 22:54   ` Mykola Stryebkov
2009-09-24  8:03     ` David Allsopp
2009-09-24  9:45       ` blue storm
2009-09-24 11:18         ` Martin Jambon
2009-09-24 12:02           ` blue storm
2009-09-24 12:19             ` Martin Jambon
2009-10-03 12:16               ` Anil Madhavapeddy
2009-10-03 17:27                 ` blue storm
2009-10-03 18:29                   ` Anil Madhavapeddy [this message]
2009-09-26  7:37             ` ygrek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=670A1DC9-9795-4DD0-82E5-FA97D837A813@recoil.org \
    --to=anil@recoil.org \
    --cc=bluestorm.dylc@gmail.com \
    --cc=caml-list@yquem.inria.fr \
    --cc=martin.jambon@ens-lyon.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).