#1295 closed defect (fixed)
module-environment use with macros
Reported by: | Caolan McMahon | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | 5.4 |
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 (7)
comment:1 Changed 8 years ago by
Estimated difficulty: | → hard |
---|
comment:2 Changed 8 years ago by
comment:3 Changed 8 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)))))
comment:4 Changed 11 months ago by
Milestone: | someday → 6.0.0 |
---|
comment:6 Changed 11 months ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:7 Changed 11 months ago by
Milestone: | 6.0.0 → 5.4 |
---|
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