[plt-scheme] defines and modules inside macro

From: Chognkai Zhu (czhu at cs.utah.edu)
Date: Thu Nov 12 15:59:55 EST 2009

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
>   



Posted on the users mailing list.