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=1.1 required=5.0 tests=AWL,SPF_NEUTRAL autolearn=disabled version=3.1.3 Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id D1356BC6B for ; Thu, 28 Jun 2007 09:44:18 +0200 (CEST) Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.180]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l5S7iHcx010431 for ; Thu, 28 Jun 2007 09:44:18 +0200 Received: by wa-out-1112.google.com with SMTP id j37so620178waf for ; Thu, 28 Jun 2007 00:44:17 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=R1nbnzJqKGNDSI3AXVvrHlOJxfEabDCp3IljR0yKiOOD+kfbJ0mLVJWf2ChcOWdmXJPOhf17eEmlUPPpDA0HCVWsMTxoPlD/qW6G5JUsZEINCtCr58jxWdhY8WWX0kt12ktZVLnrIz3X3IpHS54Zeqqt7Afe7L8/eX5s00cIsww= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=nG0/aS1KvbXZFsqKYihuEwJdZlX6vVpefYVPrtr007eWrubR4wHpXCbxENNmCKuovEUBWPOv6RyXa2Fzjcvbf8NXWw9zxOKI+ABRtAkgIoc95LcyVXEv6ic2RqlWmv3W9i2slP382jrfrDNzud2aL16suhA5pmEJacrI1LNxxYk= Received: by 10.114.209.1 with SMTP id h1mr1327312wag.1183016656890; Thu, 28 Jun 2007 00:44:16 -0700 (PDT) Received: by 10.114.181.8 with HTTP; Thu, 28 Jun 2007 00:44:16 -0700 (PDT) Message-ID: Date: Thu, 28 Jun 2007 09:44:16 +0200 From: "Nicolas Pouillard" To: "Christopher L Conway" Subject: Re: [Caml-list] C-like macros in OCaml Cc: "Loup Vaillant" , caml-list@yquem.inria.fr In-Reply-To: <4a051d930706270553o2227f1e2h54893fd0929855dc@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <1B4EC64C-435D-42C5-95F3-C01869DD41FB@rice.edu> <20070627041034.GA7232@furbychan.cocan.org> <46821522.80602@ed.ac.uk> <6f9f8f4a0706270108i10eeef7eme5c1a397158d85c4@mail.gmail.com> <4a051d930706270553o2227f1e2h54893fd0929855dc@mail.gmail.com> X-j-chkmail-Score: MSGID : 468366D1.002 on discorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at discorde with ID 468366D1.002 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; c-like:01 ocaml:01 camlp:01 c-like:01 foo:01 foo:01 defines:01 ifdef:01 contrib:01 camlp:01 wrote:01 wrote:01 caml-list:01 macros:01 macros:01 On 6/27/07, Christopher L Conway wrote: > On 6/27/07, Loup Vaillant wrote: > > By the way, does camlp4 handle cross modules C-like macros? If it does, how? > > For instance, what if I write, in foo.ml : > > DEFINE FOO = 1 > > > > and then, in bar.ml : > > let bar = FOO;; > > > > or else: > > open foo;; > > let bar = FOO;; > > > > or even : > > let bar = Foo.FOO;; > > > > Will I get what I want? > > Probably not, but that depends on what you want. ;-) I believe that > pa_macro DEFINEs have module scope. To get the same DEFINE in multiple > files, you can use -D arguments on the command line, but pa_macro > doesn't allow these arguments to have values (i.e., you can only test > IFDEF/IFNDEF).* If you want arguments, see pa_macro_arg: > http://caml.inria.fr/cgi-bin/hump.en.cgi?contrib=569 > > Chris > > * I submitted a patch for this, but I don't think it's made its way > into a release. I didn't realize the 3.10/new camlp4 push was on when > I made it. And your patch has been applied. -- Nicolas Pouillard