Zeeshan Ali wrote:

There's no way of completely removing (=> undefining) the definitions
that a module added.

      Hmm... But the GC would take care of that, wouldn't it? If it
doesn'nt then the plugins must do that themselves in their
'xchat-plugin-deinit' procedure, which they must define and export.

It should do if you really can remove all the references to the module, but I'm not sure how easy that is; I think modules live (through membership of a global list?) even if no one is using them.

I think it might be possible (in an undocumented
and unsupported way) to "unuse" a module, though, i.e. to remove a
plugin module from the module-uses list of your main module.  Is that
any use to you?

    I think that is exactly what i need. Maybe there is no way defined
to do this as the GC also takes care of 'unused' modules as they are
also normal guile objects? Thanks for your help.

Well here's what I had in mind:

(use-modules (ossau example-fns))   ; this module exports `fact1'

(define (unuse-named-module name)
  (let ((intf (resolve-interface name)))
    (set-module-uses! (current-module)
                      (delq intf (module-uses (current-module))))))

fact1 => #<procedure fact1 (n)>

(unuse-named-module '(ossau example-fns))

fact1 => ERROR: Unbound variable: fact1

It seems to survive 5 minutes of testing by me, but there could well be problems lurking, so please test carefully in your context.

        Neil


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user

Reply via email to