[plt-scheme] eval and namespaces question

From: Robert Bruce Findler (robby at cs.uchicago.edu)
Date: Mon Dec 16 15:41:35 EST 2002

Why not just do this:

  (moulde foo mzscheme (provide x) (define x 1))

?

Or, put another way, if you really need the toplevel eval-conforming
semantics, dont' use modules.

Robby

At Mon, 16 Dec 2002 15:36:07 -0500, "John W. Small" wrote:
> ------------------------------------------------------------------------------
> Hi,
> 
> I'd like to define values within a module context using eval:
> 
>     (module foo mzscheme
>       (eval '(define x 1)))
> 
> and require them in another module:
> 
>     (module bar mzscheme
>       (require foo)
>       x       ; error: expand:  unbound variable x
>     )
> 
> Since eval defines X at the top level of the current namespace it isn't
> seen within the bar module.  Is there a way to require the top level in bar
> or alternatively eval within the namespace of the module foo?  I'm sorry
> I don't understand namespaces mechanics.
> 
> Thanks!
> 
> John
> 
> 
> 
> ------------------------------------------------------------------------------



Posted on the users mailing list.