caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Stefano Zacchiroli <zack@upsilon.cc>
To: caml-list@yquem.inria.fr, OCaml <caml-list@inria.fr>
Subject: Re: [Caml-list] Using camlp4 in extensions
Date: Mon, 15 Dec 2008 23:13:48 +0100	[thread overview]
Message-ID: <20081215221348.GA16496@usha.takhisis.invalid> (raw)
In-Reply-To: <494663F2.7090409@mcmaster.ca>

On Mon, Dec 15, 2008 at 09:04:34AM -0500, Jacques Carette wrote:
> AFAIK, extensions are not ordered, so trying to use camlp4 to deal
> with IFDEF in the source of a syntax extension (like pa_monad) to
> switch between 3.10 and 3.11 [to deal with the new private and lazy
> features] does not seem possible.

Why so?

When you build a camlp4 extension you're compiling some code relying
on camlp4 _as a library_. The code you're actually compiling is
compiled by the ocaml compiler, which can possibly receive it from
whatever pre-processor. That pre-processor can of course be camlp4
itself, loading some other camlp4 extension.

In short:

  ocamlc -pp "camlp4o available_ext.cmo" -c new_ext.ml

should work.

Of course, as observed, you can have grammar conflicts between the two
extensions, but that's an entirely different problem.

Cheers.

-- 
Stefano Zacchiroli -o- PhD in Computer Science \ PostDoc @ Univ. Paris 7
zack@{upsilon.cc,pps.jussieu.fr,debian.org} -<>- http://upsilon.cc/zack/
Dietro un grande uomo c'è ..|  .  |. Et ne m'en veux pas si je te tutoie
sempre uno zaino ...........| ..: |.... Je dis tu à tous ceux que j'aime


      parent reply	other threads:[~2008-12-15 22:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-15 14:04 Jacques Carette
2008-12-15 15:24 ` [Caml-list] " Richard Jones
2008-12-15 16:10   ` Mauricio Fernandez
2008-12-15 16:15     ` Jacques Carette
2008-12-15 16:38       ` blue storm
2008-12-15 22:13 ` Stefano Zacchiroli [this message]

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=20081215221348.GA16496@usha.takhisis.invalid \
    --to=zack@upsilon.cc \
    --cc=caml-list@inria.fr \
    --cc=caml-list@yquem.inria.fr \
    /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).