unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
* dynamic module creation
@ 2009-02-01  7:58 Julian Graham
  2009-02-01 12:04 ` Andy Wingo
  0 siblings, 1 reply; 5+ messages in thread
From: Julian Graham @ 2009-02-01  7:58 UTC (permalink / raw)
  To: guile-user

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




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-02-04  0:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-01  7:58 dynamic module creation Julian Graham
2009-02-01 12:04 ` Andy Wingo
2009-02-01 19:29   ` Neil Jerram
2009-02-02  9:49   ` Ludovic Courtès
     [not found]   ` <2bc5f8210902011259w54b5e427x1de20fb88143d441@mail.gmail.com>
2009-02-04  0:30     ` Neil Jerram

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).