[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
dynamic module creation
From: |
Julian Graham |
Subject: |
dynamic module creation |
Date: |
Sun, 1 Feb 2009 02:58:36 -0500 |
Hi Guilers,
Is there a way to create a module at runtime and evaluate expressions
in it using a dynamically-created set of module imports? I want to do
something along the lines of:
(save-module-excursion
(lambda ()
(define-module (my-dynamic-module-name)
#:use-module (a-module-i-decided-to-include-at-runtime)
#:pure)
(do-something)))
...except `define-module' doesn't like being called from anywhere
except the top level. I also tried `resolve-module', the
documentation for which says:
Find the module named NAME and return it. When it has not already
been defined, try to auto-load it. When it can't be found that way
either, create an empty module.
This works as advertised -- it really does create an empty module, but
it's completely empty: No core Scheme syntax, not even any syntactic
sugar like '@ to help you get at stuff from the core. It's an utterly
blank environment. Is there some way to get the module-creation
behavior of `resolve-module' but also be able to include stuff from
other modules in the resulting environment?
Regards,
Julian
- dynamic module creation,
Julian Graham <=