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.0 required=5.0 tests=AWL,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 concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id 7CB44BC0A for ; Wed, 20 Jun 2007 14:17:23 +0200 (CEST) Received: from an-out-0708.google.com (an-out-0708.google.com [209.85.132.243]) by concorde.inria.fr (8.13.6/8.13.6) with ESMTP id l5KCHMvW024959 for ; Wed, 20 Jun 2007 14:17:23 +0200 Received: by an-out-0708.google.com with SMTP id c24so29975ana for ; Wed, 20 Jun 2007 05:17:22 -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:mime-version:content-type:content-transfer-encoding:content-disposition; b=Z1h0RNDBAp+TuIXGuuxKmyqarOE1IY+8CCvy1qaOsZ7gzhjU0vKsRnz2i5efS7dQudiauahzKbzoA533sV7Uk/J5PKzpQffPO7P1o2Esdk1gUFN44nsTCbDV0B0fyd69O2rKL8O59afPCBSS4Z0N5IJCc+wBkhat7/c7HLXSMEk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type:content-transfer-encoding:content-disposition; b=KhNucuajjJoN0L4R32dq3hQC8otgfTwHKHngl//UvFn0Gis4Lj58O/jcyyEqhj+PkjvriZEHRHJ4mG0PcZyG7xOI/WGM5TzPaCFs3viVQswb96+M5Up9izh/ryrEdXpePM81W75C7Zdv94uWHBTx2ju8ptK/jbRloPE+mgC42RU= Received: by 10.100.10.20 with SMTP id 20mr321963anj.1182341842271; Wed, 20 Jun 2007 05:17:22 -0700 (PDT) Received: by 10.100.33.15 with HTTP; Wed, 20 Jun 2007 05:17:22 -0700 (PDT) Message-ID: <6f9f8f4a0706200517h17e550f9na83bb2ed97f3749d@mail.gmail.com> Date: Wed, 20 Jun 2007 14:17:22 +0200 From: "Loup Vaillant" To: "Caml List" Subject: A macro system compatible with modules MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-j-chkmail-Score: MSGID : 46791AD2.001 on concorde : j-chkmail score : X : 0/20 1 0.000 -> 1 X-Miltered: at concorde with ID 46791AD2.001 by Joe's j-chkmail (http://j-chkmail . ensmp . fr)! X-Spam: no; 0.00; compilation:01 compilation:01 indirection:01 mli:01 mli:01 functor:01 namespaces:01 camlp:01 camlp:01 macros:01 macros:01 define:01 define:01 modules:02 defined:02 Hello, I would like to define a macro system (like #define) which satisfy the following constraints : -> When I define a macro, it is available for use right now, in the same compilation unit. -> If I want to call the macro from another compilation unit, I just have to either open the corresponding module : open My_comp_unit;; (* some code *) my_macro (* macro arguments *) or access the macro through indirection : My_comp_unit.my_macro (* macro arguments *) -> [optional] a macro must declared in the .mli file to be accessible from the outside, and is automatically accessible if this .mli file is not defined by the author of the compilation unit. -> [optional] do the same things for any module (defined as is, or from a functor) This would be ideal for avoiding namespaces issues. What about plain camlp4 macros? What about the #define defined in camlp4? Is such a a thing possible? To what extent? Thanks, Loup Vaillant (reminder my ultimate goal is Lisp-like macros)