unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: "Ludovic Courtès" <INVALID.NOREPLY@gnu.org>
To: "Ludovic Courtès" <ludo@gnu.org>, bug-guile@gnu.org
Subject: [bug #29860] Macro-generated macros get wrong module context [1.9.10]
Date: Tue, 11 May 2010 20:29:05 +0000	[thread overview]
Message-ID: <20100511-202905.sv15145.4085@savannah.gnu.org> (raw)
In-Reply-To: 


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	other threads:[~2010-05-11 20:29 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-11 20:29 Ludovic Courtès [this message]
2010-05-21 11:18 ` [bug #29860] Macro-generated macros get wrong module context [1.9.10] Andy Wingo
2010-05-22  9:35   ` Ludovic Courtès
2010-05-22 14:40     ` Andy Wingo
2010-06-06 15:38 ` Andy Wingo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100511-202905.sv15145.4085@savannah.gnu.org \
    --to=invalid.noreply@gnu.org \
    --cc=bug-guile@gnu.org \
    --cc=ludo@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).