[plt-scheme] load inside a module

From: Richard C. Cobbe (cobbe at ccs.neu.edu)
Date: Sat Feb 28 19:35:35 EST 2004

Lo, on Saturday, February 28, Ron Stanonik did write:

>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> 
> I want to keep some configuration information in a file.
> For example, config.ss might contain
> 
>   (set! name "ron")
> 
> Then I'd like a module to load that configuration information.
> For example
> 
>   (module m mzscheme
>     (let ((name #f))
>       (load "config.ss")
>       (printf "hi ~a~%" name)))
> 
> load evals outside of the module (outside of the module's namespace?),
> so name isn't set! inside of the module.  I'm guessing I need to do
> something which causes the load to eval inside of the module's namespace,
> but what?

The whole idea is a bit hackish, but the following will do what you
want:

   (module m mzscheme
     (require (lib "include.ss"))
     (let ((name #f))
       (include "config.ss")
       (printf "hi ~a~%" name)))

Richard


Posted on the users mailing list.