URL:
  <http://savannah.gnu.org/bugs/?29860>

                 Summary: Macro-generated macros get wrong module context
[1.9.10]
                 Project: Guile
            Submitted by: civodul
            Submitted on: Tue 11 May 2010 08:29:05 PM GMT
                Category: None
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

Here's a macro-generating macro:

#v+
(define-module (mm)
  #:export (make-the-macro))

(define (hello)
  (display "hello\n"))

(define-syntax make-the-macro
  (syntax-rules ()
    ((_ name)
     (define-syntax name
       (syntax-rules ()
         ((_) (hello)))))))
#v-

Wherever the macro generated by `make-the-macro' is expanded, it should look
up `hello' in the context of (mm), but it does not:

#v+
(use-modules (mm))

(make-the-macro foo)

(foo)
#v-

=>

#v+
ERROR: In procedure module-lookup:
ERROR: Unbound variable: hello
#v-

The problem manifests itself when expanding `ssax:make-parser' (from (sxml
ssax)): the expanded code looks up `ssax:warn', `nl', etc., in the context of
the expansion point, not in the context of (sxml ssax).

Ludo'.




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?29860>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/


Reply via email to