[plt-scheme] Copying bindings between namespaces
Shriram Krishnamurthi <sk at cs.brown.edu> writes:
>Are you aware of the new module system in PLT 200 (whose head keyword
>is `module')? If for some reason you've rejected a solution based on
>that, it would help to know why.
>
I looked into this module system and couldn't really figure out how to
use it. I tried something like this:
First let's create a module which contains the forms I want:
(module my-primitives mzscheme
(provide +)
(provide #%module-begin)
(provide #%app)
(provide #%datum)
(provide #%top)
(provide define)
(provide provide))
And this has to be required:
(require my-primitives)
Now I can create another module which uses 'my-primitives' and thus
contains only the needed forms and primitives:
(module my-eval-module my-primitives
(define result <untrusted code here>)
(provide result))
After this, I require 'my-eval-module' and get the evalution result
from the variable 'result'. So it seems that this would need a macro
wrapped to the code above but I I can't do this because module
declarations can appear only at the top level.
--
Timo Lilja