GNU bug report logs -
#43025
re-export-public-interface fails on Guile 3
Previous Next
Reported by: Dale Smith <dalepsmith <at> gmail.com>
Date: Mon, 24 Aug 2020 16:12:01 UTC
Severity: normal
Done: Dale Smith <dalepsmith <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
Am Mittwoch, den 26.08.2020, 12:51 -0400 schrieb Dale Smith:
> On 8/24/20, Leo Prikler <leo.prikler <at> 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.
This bug report was last modified 4 years and 157 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.