diff options
author | Andy Wingo <wingo@pobox.com> | 2010-11-18 21:48:55 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2010-11-18 21:48:55 +0100 |
commit | c9b16ceef7fe382aef3c4d236bdc83901d55d18d (patch) | |
tree | f43887fdb6198e290475ed0b2d85ace33c2c42b0 | |
parent | 3740c788ac67f7867ef41165380cff877666d219 (diff) | |
download | guile-c9b16ceef7fe382aef3c4d236bdc83901d55d18d.tar.gz |
add `reload-module' to boot-9
* module/ice-9/boot-9.scm (reload-module): New procedure,
programmatically reloads the source file corresponding to the given
module.
-rw-r--r-- | module/ice-9/boot-9.scm | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm index b3b689345..24ce62136 100644 --- a/module/ice-9/boot-9.scm +++ b/module/ice-9/boot-9.scm @@ -2252,6 +2252,18 @@ If there is no handler at all, Guile prints an error and then exits." (define (try-load-module name version) (try-module-autoload name version)) +(define (reload-module m) + (let ((f (module-filename m))) + (if f + (save-module-excursion + (lambda () + ;; Re-set the initial environment, as in try-module-autoload. + (set-current-module (make-fresh-user-module)) + (primitive-load-path f) + m)) + ;; Though we could guess, we *should* know it. + (error "unknown file name for module" m)))) + (define (purify-module! module) "Removes bindings in MODULE which are inherited from the (guile) module." (let ((use-list (module-uses module))) |