bug#43025: re-export-public-interface fails on Guile 3

Dale Smith <[email protected]>
Newsgroups gmane.lisp.guile.bugs
Message-ID <CAFGZJC5=jgdsmHi2KLAQdU4MV2i3Jj=YJxOagM02aBnuhtXhvg@mail.gmail.com>
On 8/24/20, Leo Prikler <[email protected]> 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))
       ...))))
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.