From: Joris van der Hoeven <TeXmacs@math.u-psud.fr>
Cc: guile-devel@gnu.org
Subject: Re: Two questions about the guile module system
Date: Fri, 4 Apr 2003 18:06:38 +0200 (CEST) [thread overview]
Message-ID: <Pine.GSO.4.33.0304041801120.1366-100000@sunanh> (raw)
In-Reply-To: <878yuvd14m.fsf@zagadka.ping.de>
> > > 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
parent reply other threads:[~2003-04-04 16:06 UTC|newest]
Thread overview: expand[flat|nested] mbox.gz Atom feed
[parent not found: <878yuvd14m.fsf@zagadka.ping.de>]
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=Pine.GSO.4.33.0304041801120.1366-100000@sunanh \
--to=texmacs@math.u-psud.fr \
--cc=guile-devel@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).