mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
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.
This commit is contained in:
parent
3740c788ac
commit
c9b16ceef7
1 changed files with 12 additions and 0 deletions
|
@ -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)))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue