guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

reload-module


From: Ludovic Courtès
Subject: reload-module
Date: Thu, 18 Nov 2010 22:45:25 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

Hello!

"Andy Wingo" <address@hidden> writes:

> +(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))))

What about adding

  (module-define-submodule! the-root-module (module-name m)
                            (let ((x (make-module)))
                              (set-module-name! x (module-name m))
                              x))

right before the ‘primitive-load-path’ call, such that the module is
created anew, instead of being modified incrementally?

Thanks,
Ludo’.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]