unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Leo Prikler <leo.prikler@student.tugraz.at>
To: Dale Smith <dalepsmith@gmail.com>
Cc: 43025@debbugs.gnu.org
Subject: bug#43025: re-export-public-interface fails on Guile 3
Date: Wed, 26 Aug 2020 19:06:00 +0200	[thread overview]
Message-ID: <5120663b69aa5e340de4b7be455d8fe2e9d233e7.camel@student.tugraz.at> (raw)
In-Reply-To: <CAFGZJC5=jgdsmHi2KLAQdU4MV2i3Jj=YJxOagM02aBnuhtXhvg@mail.gmail.com>

Am Mittwoch, den 26.08.2020, 12:51 -0400 schrieb Dale Smith:
> On 8/24/20, Leo Prikler <leo.prikler@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.  






  reply	other threads:[~2020-08-26 17:06 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-24 16:11 bug#43025: re-export-public-interface fails on Guile 3 Dale Smith
2020-08-24 19:50 ` Leo Prikler
2020-08-26 16:51   ` Dale Smith
2020-08-26 17:06     ` Leo Prikler [this message]
2020-08-27  2:21     ` Dale Smith
2020-08-28  0:12       ` Dale Smith
2020-08-28 19:22         ` Dale Smith
2021-03-12 14:12 ` Dale Smith

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5120663b69aa5e340de4b7be455d8fe2e9d233e7.camel@student.tugraz.at \
    --to=leo.prikler@student.tugraz.at \
    --cc=43025@debbugs.gnu.org \
    --cc=dalepsmith@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).