[plt-scheme] Can I create module on the fly?

From: Eli Barzilay (eli at barzilay.org)
Date: Thu Jul 17 16:52:40 EDT 2008

On Jul 17, Jens Axel Soegaard wrote:
> Gregory Woodhouse skrev:
> > (Actually, I'd like the module to be something I can read from a file 
> > port at runtime)
> >
> > My initial attempt was
> >
> > > (define md (quote
> >               (module m scheme/base
> >                 (define x 11))))
> > > (define ns (module->namespace ....
> >
> > But here I'm stuck. By itself, md or 'md isn't a legitimate module 
> > path, but I'd like to create a namespace for eval, so I can evaluate 
> > expressions in the module environment.
> 
> Just thinking out loud. How about:
> 
>    1. Use write to save  md  to a file named "md.scm".
>    2. Use dynamic-require.
> 
> ?

(BTW, this is equivalent to `eval' -- and having this done for
expressions that you read from a port is not really a good idea...)

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                  http://www.barzilay.org/                 Maze is Life!


Posted on the users mailing list.