[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#43025: re-export-public-interface fails on Guile 3
From: |
Leo Prikler |
Subject: |
bug#43025: re-export-public-interface fails on Guile 3 |
Date: |
Wed, 26 Aug 2020 19:06:00 +0200 |
User-agent: |
Evolution 3.34.2 |
Am Mittwoch, den 26.08.2020, 12:51 -0400 schrieb Dale Smith:
> On 8/24/20, Leo Prikler <leo.prikler@student.tugraz.at> wrote:
> > My solution for this problem would be to build on some of the
> > module
> > "intrinsics", which sadly are not all that well documented.
> >
> > (define-module (a))
> >
> > (let ((obs (module-obarray (resolve-interface '(srfi srfi-1))))
> > (iface (module-public-interface (current-module))))
> > (hash-fold
> > (lambda (key value seed)
> > (module-add! iface key value)
> > seed)
> > *unspecified*
> > obs))
> >
> > If you want to make this a macro, you really only need to syntax-
> > unquote a module into the (resolve-interface ...) portion of this
> > snippet.
>
> So with that in mind, how about something like this (currently no
> error checking):
>
> (define-syntax re-export-public-interface
> (syntax-rules ()
> ((_ mod ...)
> (let ((iface (module-public-interface (current-module))))
> (module-for-each
> (lambda (sym val)
> (module-add! iface sym val)
> (hashq-set! (module-replacements iface) sym #t))
> (resolve-interface 'mod))
> ...))))
LGTM, but don't forget to test it ;)
Also I'd call it `re-export-public-interface!', or even `re-export-and-
replace-interface!' but that's a personal preference.