unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: Neil Jerram <neil@ossau.uklinux.net>
Cc: guile-user@gnu.org
Subject: Re: Module unloading
Date: Mon, 23 May 2005 22:23:47 +0100	[thread overview]
Message-ID: <429249E3.1050604@ossau.uklinux.net> (raw)
In-Reply-To: <38294b74050523135563afe3dc@mail.gmail.com>

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	other threads:[~2005-05-23 21:23 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-23 14:03 Module unloading Zeeshan Ali
2005-05-23 18:18 ` Neil Jerram
2005-05-23 20:55   ` Zeeshan Ali
2005-05-23 21:23     ` Neil Jerram [this message]
2005-05-24 13:02       ` Zeeshan Ali
2005-05-24 18:15         ` Neil Jerram
2005-05-24 21:06           ` Zeeshan Ali
2005-05-24 21:26             ` Zeeshan Ali
2005-05-26 12:16               ` Zeeshan Ali
2005-05-26 18:33                 ` Neil Jerram
2005-05-26 20:00                   ` Zeeshan Ali
2005-05-26 18:25               ` Neil Jerram
2005-05-26 19:45                 ` Zeeshan Ali
2005-05-24 21:14           ` Rob Browning
2005-05-26 18:43             ` Neil Jerram
2005-05-26 18:57               ` Rob Browning
2005-05-26 19:05                 ` Neil Jerram

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=429249E3.1050604@ossau.uklinux.net \
    --to=neil@ossau.uklinux.net \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).