caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Anil Madhavapeddy <anil@recoil.org>
To: Martin Jambon <martin.jambon@ens-lyon.org>
Cc: blue storm <bluestorm.dylc@gmail.com>, caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Generation of Java code from OCaml
Date: Sat, 3 Oct 2009 13:16:23 +0100	[thread overview]
Message-ID: <205DBD56-053A-48B6-B37F-230FB49B7499@recoil.org> (raw)
In-Reply-To: <4ABB63ED.1000402@ens-lyon.org>

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

On 24 Sep 2009, at 13:19, Martin Jambon wrote:
>
> 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.
>

The nice thing about using type-conv is that syntax extensions can be  
composed quite easily, as long as the generators themselves don't  
depend too much on custom type syntax (e.g. when using sexplib, don't  
use the special sexp_option/sexp_opaque types).

I've ported your json-static extension over to type-conv so that we  
can use a combination of json/sexp and the (still in development) ORM  
extension side-by-side with a single type declaration, e.g.

type t = {
   foo: string;
   bar: int
} with orm (debug: all), json

... which generates both persistence functions and the json functions  
from the single type.  Right now it's fairly awkward to do this with  
json-static and the 'predefined' keyword as it requires duplicating  
types.

The ported version of json-static to type-conv is available at:
http://github.com/avsm/caml-type-conv-json/

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.  Most other types like char, int32/64, unit, poly variants,  
etc should all work.  There's a simple testcase in check_tc.ml in the  
same repository.

-anil

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

  reply	other threads:[~2009-10-03 12:16 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 [this message]
2009-10-03 17:27                 ` blue storm
2009-10-03 18:29                   ` Anil Madhavapeddy
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=205DBD56-053A-48B6-B37F-230FB49B7499@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).