Subject: Re: re-export-public-interface fails on Guile 3

From: Dale Smith <[email-masked]>
Date: Thu, 27 Aug 2020 20:12:35 -0400

And here has some better error handling/reporting.

(define-syntax re-export-public-interface
  (syntax-rules ()
    "Re-export the public interface of a module or modules. Invoked as
@code{(re-export-public-interface (mod1) (mod2) ...)}."
    ((_ (m0 m0* ...) (mn mn* ...) ...)
     (let ((iface (module-public-interface (current-module))))
       (define (r-e-p-i module)
	 (cond-expand
	  (guile-3
	   (module-for-each
	    (lambda (sym val)
	      (hashq-set! (module-replacements iface) sym #t)
	      (module-add! iface sym val))
	    (resolve-interface module)))
	  (else
	   (module-use! iface (resolve-interface module)))))
       (r-e-p-i '(m0 m0* ...))
       (r-e-p-i '(mn mn* ...))
       ...))
    ((_)
     (syntax-violation 're-export-public-interface
		       "must provide one or more module names"
		       '(re-export-public-interface)))
    ((_ m m* ...)
     (syntax-violation 're-export-public-interface
		       "module names must look like lists"
		       '(re-export-public-interface m m* ...)))))