define-macro behaviour inside the module definition.

Vitaly Lugovsky <[email protected]> Sun, 09 Oct 2005 20:10:28 +0100
Newsgroups gmane.comp.java.sisc.devel
Message-ID <[email protected]>

 Hi, all!

 I noticed an unpleasant trouble with the define-macro expansion inside the
module, which is seems to be related to the way the modules are
implemented (as
a letrec).

 Here is an example:

;; This is not working:

(module mod1 (m1)
        (define (f1 x) `(+ ,x ,x))
        (define-macro (m1 x) (f1 x)))

;;
;; The following is ok.
;;
(module mod1 (f1)
        (define (f1 x) `(+ ,x ,x))
        )

(module mod2 (m1)
        (import mod1)
        (define-macro (m1 x) (f1 x)))

;;
;; Not working again - thus the previous solution is not suitable
;;  for the 2nd-tier macros (macros producing (begin ...) with functions and
;;   macros defs).
;;
(module mod0 ()
        (module mod1 (f1)
                (define (f1 x) `(+ ,x ,x))
                )

        (module mod2 (m1)
                (import mod1)
                (define-macro (m1 x) (f1 x)))
        )

       
       


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl