caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Martin Jambon <martin.jambon@ens-lyon.org>
To: Nicolas Pouillard <nicolas.pouillard@gmail.com>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Camlp4 3.10.0+beta: lists without $list:...$
Date: Fri, 23 Mar 2007 12:00:51 -0700 (PDT)	[thread overview]
Message-ID: <Pine.LNX.4.58.0703231121180.14832@localhost> (raw)
In-Reply-To: <cd67f63a0703230935t36d2afbfjeb893513c43fbf0f@mail.gmail.com>

On Fri, 23 Mar 2007, Nicolas Pouillard wrote:

> On 3/23/07, Martin Jambon <martin.jambon@ens-lyon.org> wrote:
> > I managed to create an object type using camlp4orf:
> >
> > let ctyp_object _loc ml =
> >    let fields =
> >      List.fold_left
> >        (fun o (name, typ) ->
> >          let m = <:ctyp< $lid:name$ : $typ$ >> in
> >          <:ctyp< $o$; $m$ >>)
> >        <:ctyp< >> ml in
> >    <:ctyp< < $fields$ > >>
> >
> > where ml is a list of method declarations of type (string * ctyp) list.
> > Before we just had to do this:
> >
> > <:ctyp< < $list:ml$ > >>
> >
> > Is there anything simpler than my solution? Is a shortcut available?
>
> In fact there is some shortcuts but it was not for all constructions
> (fixed now in CVS).
...
> You can note that in `` [ $list:cases$ '' I used the $list:...$
> antiquotation that was used to inject some list in a tree. In 3.10 you
> can still do that, but  that's a sugar for a function call that will
> join all your trees by the proper separator (bar here).
>
> FYI, I've just added all the missing $list:$ sugars to the CVS version
> (will be public soon).

Thanks.


> > PS: any progress on the manual? It's kind of hard to test new features
> > when you don't know what they are.
>
> I agree, but there is still no progress on the documentation :(
>
> BTW, have you read these slides
> http://gallium.inria.fr/~pouillar/pub/camlp4/renovation-camlp4-longue.pdf

OK, I am trying to convert my syntax extensions and everyday I hit a new
problem, which by default I report as a bug because if it's not documented
as an intentional incompatiblity, it must be a bug.

I started with pa_json_static.ml
(from http://martin.jambon.free.fr/json-static.html)
because it's fairly complete and doesn't use any dirty trick.
It manipulates all kinds of types, each of them as exprs, patts and ctyps.
So I guess once this works, it would be a big progress toward upgrading
all my stuff.

I'll publish the commented diffs as soon as I get a version that works,
but it would be much faster if you could do it for me. The thing is I
don't really know how I can help.

For now I am stuck with record type definitions:
With quotations in the revised syntax (command camlp4orf), how to create a
record field with an optional mutable flag?

  <:ctyp< $name$ : $opt:is_mutable$ $t1$ >>

gives a syntax error (well, that was yesterday night and it was late and
I don't have the details here, but you can check).
It's only needed because the $list:...$ is not supported for building my
whole record declaration, in version 3.10.0+beta that is.


Thanks

Martin

--
Martin Jambon
http://martin.jambon.free.fr


  reply	other threads:[~2007-03-23 19:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-23  6:13 Martin Jambon
2007-03-23 16:03 ` [Caml-list] " Markus Mottl
2007-03-23 16:35 ` Nicolas Pouillard
2007-03-23 19:00   ` Martin Jambon [this message]
2007-03-24 12:21     ` Nicolas Pouillard
2007-03-24 20:24       ` Martin Jambon
2007-03-26  6:48         ` Markus Mottl
2007-03-26  7:27       ` Hendrik Tews

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=Pine.LNX.4.58.0703231121180.14832@localhost \
    --to=martin.jambon@ens-lyon.org \
    --cc=caml-list@inria.fr \
    --cc=nicolas.pouillard@gmail.com \
    /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).