Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
Generation of Java code from OCaml
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2009-09-24 (11:26)
From: Martin Jambon <martin.jambon@e...>
Subject: Re: [Caml-list] Generation of Java code from OCaml
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 (  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 }