[plt-scheme] syntax form works in top-level env, but not when imported from module.
Could someone look at what's happening with the code
beneath? I just don't understand what's going on.
Thanks in advance,
Hans
*********************************************************
I declare
(module a mzscheme
(provide a)
(define (is-op? s f)
(if (eq? s 'like)
s
(f)))
(define-syntax a
(syntax-rules ()
((_ c)
(is-op? 'c (lambda () (* c c))))))
)
(module b mzscheme
(require "a.scm")
(define Q 22)
(display (a Q))(newline)
(display (a like))(newline)
)
Now, in the toplevel environment:
> (require "a.scm")
> (a like)
like
> (a 2)
4
But:
> (require "b.scm")
b.scm:16:12: compile: unbound variable in module in: like
Now add "(define like 10)" to b.scm (just above the expansion of (a like))
> (require "b.scm")
100
like
*********************************************************