Opened 7 years ago
Last modified 6 years ago
#1295 new defect
module-environment use with macros
Reported by: | Caolan McMahon | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | someday |
Component: | core libraries | Version: | 4.11.0 |
Keywords: | Cc: | ||
Estimated difficulty: | hard |
Description
Given the following module example.scm:
(module example * (import chicken scheme) (define (add a b) (+ a b)) (define-syntax double (syntax-rules () ((_ x) (add x x)))) )
Then, using it as an eval environment:
(load "./example.scm") (import example) (print (eval '(double 10) (module-environment 'example)))
I get:
Error: unbound variable: add43
Using the macro directly it appears to work:
(load "./example.scm") (import example) (print (double 10))
It now prints 20, as expected.
Is this a problem with module-environment, or am I using it incorrectly?
Change History (3)
comment:1 Changed 7 years ago by
Estimated difficulty: | → hard |
---|
comment:2 Changed 7 years ago by
comment:3 Changed 6 years ago by
Just in case anyone else runs into this issue, I'm working around it by using er-macro-transformer instead of syntax-rules:
(define-syntax double (er-macro-transformer (lambda (exp rename compare) (list (rename 'add) (cadr exp) (cadr exp)))))
Note: See
TracTickets for help on using
tickets.
This looks like a bug, but I'll have to look closer when I have more time