From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Joris van der Hoeven Newsgroups: gmane.lisp.guile.devel,gmane.lisp.guile.user Subject: Re: Two questions about the guile module system Date: Fri, 4 Apr 2003 18:06:38 +0200 (CEST) Sender: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Message-ID: References: <878yuvd14m.fsf@zagadka.ping.de> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: main.gmane.org 1049472698 25521 80.91.224.249 (4 Apr 2003 16:11:38 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 4 Apr 2003 16:11:38 +0000 (UTC) Cc: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Fri Apr 04 18:11:37 2003 Return-path: Original-Received: from monty-python.gnu.org ([199.232.76.173]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 191Tmy-0006dV-00 for ; Fri, 04 Apr 2003 18:11:37 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 191TlR-0004C0-09 for guile-devel@m.gmane.org; Fri, 04 Apr 2003 11:10:01 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 191Tkk-0003h3-00 for guile-devel@gnu.org; Fri, 04 Apr 2003 11:09:18 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 191TkY-0003Xb-00 for guile-devel@gnu.org; Fri, 04 Apr 2003 11:09:06 -0500 Original-Received: from matups.math.u-psud.fr ([129.175.50.4]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 191TiH-000234-00; Fri, 04 Apr 2003 11:06:45 -0500 Original-Received: from anh.math.u-psud.fr (sunanh.math.u-psud.fr [129.175.50.1]) h34G6d8W011266 ; Fri, 4 Apr 2003 18:06:39 +0200 (MEST) Original-Received: by anh.math.u-psud.fr (Postfix, from userid 8116) id E10DFC00E; Fri, 4 Apr 2003 18:06:38 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by anh.math.u-psud.fr (Postfix) with ESMTP id D871658D6; Fri, 4 Apr 2003 18:06:38 +0200 (CEST) X-X-Sender: Original-To: Marius Vollmer In-Reply-To: <878yuvd14m.fsf@zagadka.ping.de> Original-cc: guile-user@gnu.org Original-cc: contact@texmacs.org X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Developers list for Guile, the GNU extensibility library List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.lisp.guile.devel:2126 gmane.lisp.guile.user:1763 X-Report-Spam: http://spam.gmane.org/gmane.lisp.guile.devel:2126 > > > What about: > > > > > > module.scm > > > > > > (define-module (module) > > > :use-module (library)) > > > > > > ... > > > (foo) > > > ... > > > > > > This way, 'module' says explicitely that it is using bindings from > > > 'library'. > > > > That is precisely what I do not want to do. The point is that > > I have not one library module, but dozens of them. I do not want > > to respecify all of them over and over again. > > Then what about making a new macro that does this speciying for you? > > For example: > > (define-macro (define-my-module name . rest) > `(define-module ,name > :use-module (library) > ,@rest)) > > You then only need to make sure that 'define-my-module' is available > in the current module when you load a file that uses it. This is not very satisfactory either, in my opinion. But I did find a way to hack exporting all symbols from the public interface of a module. With this, both my original questions can be answered. Here is the code: (define-macro (export-from . which-list) (define (module-exports which) (let* ((m (resolve-module which #f)) (m-public (module-ref m '%module-public-interface #f)) (l '())) (module-for-each (lambda (symb . tail) (set! l (cons symb l))) m-public) l)) (let ((l (apply append (map module-exports which-list)))) `(export ,@l))) If you want to include that piece of code into Guile, then please go ahead. One might want to replace 'export' by 're-export' in recent versions of Guile. _______________________________________________ Guile-devel mailing list Guile-devel@gnu.org http://mail.gnu.org/mailman/listinfo/guile-devel