This seems to  work for guile-2.2 and guile-3.
Would be nice if it checked that module names look like lists.

One step closer to g-golf working on guile-3!

(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) ...)}."
    ((_ mod mods ...)
     (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 'mod)
       (r-e-p-i 'mods)
       ...))))



Reply via email to