caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Gabriel Scherer <gabriel.scherer@gmail.com>
To: Hendrik Boom <hendrik@topoi.pooq.com>
Cc: caml users <caml-list@inria.fr>
Subject: Re: [Caml-list] Is this the right place to discuss camlp5?
Date: Mon, 26 Oct 2015 16:30:39 +0100	[thread overview]
Message-ID: <CAPFanBGCcfOPVYWZtm1zya5rKU4VNzi=enxy54iKn+bfPYd-7g@mail.gmail.com> (raw)
In-Reply-To: <20151026151809.GA23211@topoi.pooq.com>

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

To my knowledge, nobody has contributed parsing of attributes and
extensions (a change to the OCaml syntax whose use is central to many of
the ppx extensions) to camlp4 or camlp5 (which implement their own OCaml
parsers and thus need to be updated accordingly). It would not necessarily
be too difficult to do so, but that means that currently you cannot combine
camlp{4,5} and PPX extensions within the same source file.

There is another way to understand your question: if you have developed
camlp{4,5} extensions, how hard is it to port them to ppx, or conversely to
port a ppx extension to camlp{4,5}? My answer would be "rather easy",
knowing that there are two separate aspects:

- The first thing an extension does is to parse some part of the user input
to recognize extension-specific code. This is relatively easy to do using
both systems, but done in a completely different ways, so this part (the
"frontend") of the extension needs to be completely rewritten. In addition,
ppx is more restricted than camlp{4,5} in terms of the flexibility to
change the syntax (this is a feature), so some things that are easy to do
for camlp{4,5} extensions may require some thoughts about how to express
this with extensions/attributes instead.

- Once the extension has recognized the information it relies on within the
user source code, it will do some extension-specific stuff and spit some
AST out. This is very easy to port from one extension to the other, and
most of this part of the code (the "backend") can be reused.

The respective size of frontend and backend differs depending on the
extension. The more complex the frontend part, the harder the transition
from one system to another (this also applies to porting an extension from
camlp4 to camlp5 or vice-versa).


On Mon, Oct 26, 2015 at 4:18 PM, Hendrik Boom <hendrik@topoi.pooq.com>
wrote:

> On Mon, Oct 26, 2015 at 02:27:23PM +0000, David Allsopp wrote:
> > Hendrik Boom wrote:
> > > On Mon, Oct 26, 2015 at 01:35:45PM +0000, Soegtrop, Michael wrote:
> > > > Dear Ocaml Users,
> > > >
> > > > I just wanted to ask, if this is the right place to discuss camlp5,
> or
> > > if there is a better place. I have a rather bizarre build issue on
> Cygwin
> > > and a fix (well a hack) for it.
> > >
> > > Now I've heard about campl5, presumably a successor to campl4, and
> about
> > > ppx, touted as a successor to camlp4.
> >
> > In fact, camlp5 is technically the predecessor of camlp4! camlp4 was
> incompatibly re-worked for OCaml 3.10 (I think it was 3.10, anyway) -
> Daniel De Rauglaudre, the author of the original camlp4 but at that time
> not its maintainer, decided to continue development of the original camlp4
> but, to avoid creating even more hell in the upgrade to OCaml 3.10, renamed
> the tool to camlp5. So camlp5 is basically a maintained fork of an older
> version of camlp4.
> >
> > ppx is a much more recent innovation designed to replace most uses of
> both those tools. Which is at least part of the reason that camlp4 is no
> longer included in mainline OCaml.
> >
> > > What gives here?
> >
> > History! And also that converting between camlp4/camlp5/ppx is
> non-trivial. If doing something new, and you don't need to worry about
> older OCamls, ppx is the way to go...
>
> How incomptible are they?  I don't expect to be able to use ppx in
> the place of camlp4 on camlp4 code, but is there any difficulty
> combining legacy code written using camlp4 with new code written
> using ppx?
>
> -- hendrik
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa.inria.fr/sympa/arc/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>

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

  reply	other threads:[~2015-10-26 15:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-26 13:35 Soegtrop, Michael
2015-10-26 13:40 ` Gabriel Scherer
2015-10-26 14:01   ` Soegtrop, Michael
2015-10-26 14:21 ` Hendrik Boom
2015-10-26 14:27   ` David Allsopp
2015-10-26 15:18     ` Hendrik Boom
2015-10-26 15:30       ` Gabriel Scherer [this message]
2015-10-26 23:50         ` [Caml-list] campp{4,5} and ppx Hendrik Boom
2015-10-26 14:29   ` [Caml-list] Is this the right place to discuss camlp5? Ashish Agarwal

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='CAPFanBGCcfOPVYWZtm1zya5rKU4VNzi=enxy54iKn+bfPYd-7g@mail.gmail.com' \
    --to=gabriel.scherer@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=hendrik@topoi.pooq.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).