GNU bug report logs - #43025
re-export-public-interface fails on Guile 3

Previous Next

Package: guile;

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

From: Dale Smith <dalepsmith <at> gmail.com>
To: Leo Prikler <leo.prikler <at> student.tugraz.at>
Cc: 43025 <at> debbugs.gnu.org
Subject: bug#43025: re-export-public-interface fails on Guile 3
Date: Wed, 26 Aug 2020 12:51:18 -0400
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))
       ...))))




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.