From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.1.3 (2006-06-01) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=AWL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from mail4-relais-sop.national.inria.fr (mail4-relais-sop.national.inria.fr [192.134.164.105]) by yquem.inria.fr (Postfix) with ESMTP id 92CEFBBAF for ; Mon, 15 Dec 2008 23:14:12 +0100 (CET) X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: As0CALdlRklDz4HegWdsb2JhbACTUwEBFiK4aoJ+ X-IronPort-AV: E=Sophos;i="4.36,226,1228086000"; d="scan'208";a="32693567" Received: from fettunta.fettunta.org ([67.207.129.222]) by mail4-smtp-sop.national.inria.fr with ESMTP; 15 Dec 2008 23:14:12 +0100 Received: from usha.takhisis.invalid (unknown [10.17.0.10]) by fettunta.fettunta.org (Postfix) with ESMTP id D6E5F18442; Mon, 15 Dec 2008 22:14:09 +0000 (UTC) Received: by usha.takhisis.invalid (Postfix, from userid 1000) id C7E8E7387; Mon, 15 Dec 2008 23:13:48 +0100 (CET) Date: Mon, 15 Dec 2008 23:13:48 +0100 From: Stefano Zacchiroli To: caml-list@yquem.inria.fr, OCaml Subject: Re: [Caml-list] Using camlp4 in extensions Message-ID: <20081215221348.GA16496@usha.takhisis.invalid> Mail-Followup-To: caml-list@yquem.inria.fr, OCaml References: <494663F2.7090409@mcmaster.ca> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <494663F2.7090409@mcmaster.ca> User-Agent: Mutt/1.5.18 (2008-05-17) X-Spam: no; 0.00; zacchiroli:01 zack:01 camlp:01 afaik:01 camlp:01 ifdef:01 syntax:01 ocaml:01 compiler:01 ocamlc:01 -pp:01 cmo:01 cheers:01 zacchiroli:01 postdoc:01 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