Browse thread
Generation of Java code from OCaml
[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Anil Madhavapeddy <anil@r...> |
| Subject: | Re: [Caml-list] Generation of Java code from OCaml |
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