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.4 required=5.0 tests=SPF_NEUTRAL autolearn=disabled version=3.1.3 X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from discorde.inria.fr (discorde.inria.fr [192.93.2.38]) by yquem.inria.fr (Postfix) with ESMTP id 2C5DFBC6B for ; Wed, 27 Jun 2007 14:53:09 +0200 (CEST) Received: from wr-out-0506.google.com (wr-out-0506.google.com [64.233.184.239]) by discorde.inria.fr (8.13.6/8.13.6) with ESMTP id l5RCr52A017570 for ; Wed, 27 Jun 2007 14:53:08 +0200 Received: by wr-out-0506.google.com with SMTP id i28so92963wra for ; Wed, 27 Jun 2007 05:53:05 -0700 (PDT) DKIM-Signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=AiTIbAUzFeUqSWLrfDdyPtH4oFBennXhUnb2ZfDYMSC6p5ok3JKAOZMSXpK9gyeC5atxp8Zk3U0kN6A0ZeCUJCNRS7scHE1t0yDgqJb/jq0vLu2PBqT5l5PG+lVkibDS0eKyA4omu0NfeLtWZns4maMPzmp1OPA3+g1HJfCQLpI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=bn2RpzSE3K27v++VZlW1ejI1G0Z2l2YF2r3SmZnPbibj1D9B1VjV5B8KzeRko/LQQ0QdA59Ikiw1r0qQiKta0fB06v1nXDP0x5E7G1zU8swJevKemBsytGKmuZATq+1nWeOI+/Ip+j3vrb+1ExacbcgPDxNYuauqfVU9850SJTk= Received: by 10.78.134.12 with SMTP id h12mr251957hud.1182948784126; Wed, 27 Jun 2007 05:53:04 -0700 (PDT) Received: by 10.78.158.5 with HTTP; Wed, 27 Jun 2007 05:53:04 -0700 (PDT) Message-ID: <4a051d930706270553o2227f1e2h54893fd0929855dc@mail.gmail.com> Date: Wed, 27 Jun 2007 08:53:04 -0400 From: "Christopher L Conway" Sender: christopherleeconway@gmail.com To: "Loup Vaillant" Subject: Re: [Caml-list] C-like macros in OCaml Cc: caml-list@yquem.inria.fr In-Reply-To: <6f9f8f4a0706270108i10eeef7eme5c1a397158d85c4@mail.gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; 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> X-Google-Sender-Auth: 84aded63efdbf7d0 X-Miltered: at discorde with ID 46825DB1.000 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 idem:01 pointer:01 beginner's:01 ocaml:01 bug:01 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. > Now, what about regular quotations? And grammar rules? How can I > specify the scope of particular grammar rule (or quotation)? For the > little I know about camlp4, once defined, the scope of a new grammar > rule is global. (Idem for quotations). > > Am I right? > Any clue about the way camlp4 keep track of new grammar rules an > quotations? (Or some pointer to the documentation involved) > > Thanks > Loup Vaillant > > _______________________________________________ > Caml-list mailing list. Subscription management: > http://yquem.inria.fr/cgi-bin/mailman/listinfo/caml-list > Archives: http://caml.inria.fr > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > >