From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Neil Jerram Newsgroups: gmane.lisp.guile.user Subject: Re: Module unloading Date: Mon, 23 May 2005 22:23:47 +0100 Message-ID: <429249E3.1050604@ossau.uklinux.net> References: <38294b74050523070378b75caf@mail.gmail.com> <42921E8E.7060503@ossau.uklinux.net> <38294b74050523135563afe3dc@mail.gmail.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1116884003 30714 80.91.229.2 (23 May 2005 21:33:23 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 23 May 2005 21:33:23 +0000 (UTC) Cc: guile-user@gnu.org Original-X-From: guile-user-bounces+guile-user=m.gmane.org@gnu.org Mon May 23 23:33:20 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1DaKWJ-00073K-4C for guile-user@m.gmane.org; Mon, 23 May 2005 23:31:31 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DaKZp-0007f9-VU for guile-user@m.gmane.org; Mon, 23 May 2005 17:35:09 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1DaKYE-0007B2-Gu for guile-user@gnu.org; Mon, 23 May 2005 17:33:30 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1DaKY7-00077t-BD for guile-user@gnu.org; Mon, 23 May 2005 17:33:23 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1DaKY6-000754-CR for guile-user@gnu.org; Mon, 23 May 2005 17:33:22 -0400 Original-Received: from [80.84.72.33] (helo=mail3.uklinux.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1DaKQ0-0007hX-V9 for guile-user@gnu.org; Mon, 23 May 2005 17:25:01 -0400 Original-Received: from laruns (host81-130-111-97.in-addr.btopenworld.com [81.130.111.97]) by mail3.uklinux.net (Postfix) with ESMTP id BA2D1409FC2; Mon, 23 May 2005 21:24:58 +0000 (UTC) Original-Received: from [127.0.0.1] (laruns [127.0.0.1]) by laruns (Postfix) with ESMTP id 66E509F99D; Mon, 23 May 2005 22:23:48 +0100 (BST) User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.7) Gecko/20050420 Debian/1.7.7-2 X-Accept-Language: en Original-To: Zeeshan Ali In-Reply-To: <38294b74050523135563afe3dc@mail.gmail.com> X-BeenThere: guile-user@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: General Guile related discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: guile-user-bounces+guile-user=m.gmane.org@gnu.org Errors-To: guile-user-bounces+guile-user=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.user:4563 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.user:4563 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 => # (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