[plt-scheme] defines and modules inside macro
Reading PLT doc on valid syntax in detail, and you will find out that
"module" can't be put inside "begin".
Chongkai
Ivanov Alexey wrote:
> I am writing a macro that defines some exported values. I want one more macro to test if it has exports them
>
> (define-syntax M
> (syntax-rules ()
> ((_ n form)
> (begin
> (module x scheme form)
> (module y scheme
> (require 'x)
> (write n))))))
>
> (M f (begin (provide f) (define f 1)))
>
> but mzscheme -r throws an error:
> compile: unbound identifier in module in: f
>
> Though the expected expansion is compiled with no errors
>
> (begin
> (module x scheme (begin (provide f) (define f 1)))
> (module y scheme
> (require 'x)
> (write f)))
>
> Why?
> _________________________________________________
> For list-related administrative tasks:
> http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>