bugGuile - Bugs: bug #29860, Macro-generated macros get wrong...

 
 

bug #29860: Macro-generated macros get wrong module context [1.9.10]

Submitter:  Ludovic Courtès <civodul>
Submitted:  Tue 11 May 2010 08:29:05 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  None
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 06 Jun 2010 03:38:58 PM UTC, comment #1: 

Fixed in git, thanks for the report!

Andy Wingo <wingo>
Group administrator
Tue 11 May 2010 08:29:05 PM UTC, original submission:  

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'.

Ludovic Courtès <civodul>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by wingo (Posted a comment)
  • -email is unavailable- added by civodul (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2010-06-06 wingo StatusNone Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code