From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Leo Prikler Newsgroups: gmane.lisp.guile.bugs Subject: bug#43025: re-export-public-interface fails on Guile 3 Date: Wed, 26 Aug 2020 19:06:00 +0200 Message-ID: <5120663b69aa5e340de4b7be455d8fe2e9d233e7.camel@student.tugraz.at> References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4671"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Evolution 3.34.2 Cc: 43025@debbugs.gnu.org To: Dale Smith Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Wed Aug 26 19:07:09 2020 Return-path: Envelope-to: guile-bugs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kAytA-000184-0Q for guile-bugs@m.gmane-mx.org; Wed, 26 Aug 2020 19:07:08 +0200 Original-Received: from localhost ([::1]:43812 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kAyt8-0004Gr-Pd for guile-bugs@m.gmane-mx.org; Wed, 26 Aug 2020 13:07:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:32972) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kAyt4-0004Ew-DK for bug-guile@gnu.org; Wed, 26 Aug 2020 13:07:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:57339) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kAyt4-0004ul-2U for bug-guile@gnu.org; Wed, 26 Aug 2020 13:07:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kAyt3-00067r-Tx for bug-guile@gnu.org; Wed, 26 Aug 2020 13:07:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Leo Prikler Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Wed, 26 Aug 2020 17:07:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43025 X-GNU-PR-Package: guile X-Debbugs-Original-Cc: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.159846157823491 (code B ref -1); Wed, 26 Aug 2020 17:07:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 26 Aug 2020 17:06:18 +0000 Original-Received: from localhost ([127.0.0.1]:40652 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kAysM-00066p-0L for submit@debbugs.gnu.org; Wed, 26 Aug 2020 13:06:18 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:50542) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kAysJ-00066h-IW for submit@debbugs.gnu.org; Wed, 26 Aug 2020 13:06:16 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:60998) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kAysJ-0003kG-EW for bug-guile@gnu.org; Wed, 26 Aug 2020 13:06:15 -0400 Original-Received: from mailrelay.tugraz.at ([129.27.2.202]:1254) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kAysF-0004ow-GR for bug-guile@gnu.org; Wed, 26 Aug 2020 13:06:14 -0400 Original-Received: from nijino.local (213-147-177-210.hdsl.highway.telekom.at [213.147.177.210]) by mailrelay.tugraz.at (Postfix) with ESMTPSA id 4BcC1Q0HdCz1LXt2; Wed, 26 Aug 2020 19:06:01 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 mailrelay.tugraz.at 4BcC1Q0HdCz1LXt2 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tugraz.at; s=mailrelay; t=1598461562; bh=wH9tAW0J6GtpcJ+JfNNf8sx28TUMTiycpsZiE2KC/Zw=; h=Subject:From:To:Cc:Date:In-Reply-To:References:From; b=mCp9bMvMd64aDIPzOmT/FrKPbQBRKRxjY2NWI3rKEep+DYAwoL3HFHVF7mIQAaQpk 2jIvkpPygb9Tlk8P9NiApQp2gr2mYM5pcnTthzbaDQY6L0nlB5SdUHRgVFy79F6EC3 +kCkyNXR6FamUfo/RZ6zyh6N9H9vXU4Utuo9w3io= In-Reply-To: X-TUG-Backscatter-control: bt4lQm5Tva3SBgCuw0EnZw X-Scanned-By: MIMEDefang 2.74 on 129.27.10.116 Received-SPF: pass client-ip=129.27.2.202; envelope-from=leo.prikler@student.tugraz.at; helo=mailrelay.tugraz.at X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/26 13:06:03 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.io gmane.lisp.guile.bugs:9869 Archived-At: Am Mittwoch, den 26.08.2020, 12:51 -0400 schrieb Dale Smith: > On 8/24/20, Leo Prikler 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.