From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Newsgroups: gmane.lisp.guile.bugs Subject: bug#15540: Circular module imports vs. #:select (2.0.9) Date: Sun, 06 Oct 2013 21:36:42 +0200 Message-ID: <877gdqqjhx.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: ger.gmane.org 1381088604 11301 80.91.229.3 (6 Oct 2013 19:43:24 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 6 Oct 2013 19:43:24 +0000 (UTC) To: 15540@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Sun Oct 06 21:43:26 2013 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1VSuEe-0004Vm-R2 for guile-bugs@m.gmane.org; Sun, 06 Oct 2013 21:43:25 +0200 Original-Received: from localhost ([::1]:56269 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VSuEe-0003f3-Dn for guile-bugs@m.gmane.org; Sun, 06 Oct 2013 15:43:24 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36841) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VSuES-0003dG-OL for bug-guile@gnu.org; Sun, 06 Oct 2013 15:43:22 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VSuEJ-000754-9Z for bug-guile@gnu.org; Sun, 06 Oct 2013 15:43:12 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:49802) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VSuEJ-00074w-69 for bug-guile@gnu.org; Sun, 06 Oct 2013 15:43:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1VSuEI-0005jF-If for bug-guile@gnu.org; Sun, 06 Oct 2013 15:43:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sun, 06 Oct 2013 19:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 15540 X-GNU-PR-Package: guile X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.138108853221954 (code B ref -1); Sun, 06 Oct 2013 19:43:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 6 Oct 2013 19:42:12 +0000 Original-Received: from localhost ([127.0.0.1]:58094 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VSuDT-0005i2-WB for submit@debbugs.gnu.org; Sun, 06 Oct 2013 15:42:12 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:34970) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VSuDT-0005hv-0Z for submit@debbugs.gnu.org; Sun, 06 Oct 2013 15:42:11 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VSuDJ-0006w1-4m for submit@debbugs.gnu.org; Sun, 06 Oct 2013 15:42:10 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:38501) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VSuDJ-0006vx-10 for submit@debbugs.gnu.org; Sun, 06 Oct 2013 15:42:01 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36666) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VSuDB-0003ac-Lu for bug-guile@gnu.org; Sun, 06 Oct 2013 15:42:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VSuD4-0006ty-Cd for bug-guile@gnu.org; Sun, 06 Oct 2013 15:41:53 -0400 Original-Received: from hera.aquilenet.fr ([141.255.128.1]:57185) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VSuD3-0006t4-OV for bug-guile@gnu.org; Sun, 06 Oct 2013 15:41:46 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by hera.aquilenet.fr (Postfix) with ESMTP id 8D578ED5 for ; Sun, 6 Oct 2013 21:36:43 +0200 (CEST) Original-Received: from hera.aquilenet.fr ([127.0.0.1]) by localhost (hera.aquilenet.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id xdiMlMhlS22A for ; Sun, 6 Oct 2013 21:36:43 +0200 (CEST) Original-Received: from pluto (reverse-83.fdn.fr [80.67.176.83]) by hera.aquilenet.fr (Postfix) with ESMTPSA id 37625B41 for ; Sun, 6 Oct 2013 21:36:43 +0200 (CEST) X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 15 =?UTF-8?Q?Vend=C3=A9miaire?= an 222 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0xEA52ECF4 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 83C4 F8E5 10A3 3B4C 5BEA D15D 77DD 95E2 EA52 ECF4 X-OS: x86_64-unknown-linux-gnu User-Agent: Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 140.186.70.43 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.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:7297 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Consider these two modules: --8<---------------cut here---------------start------------->8--- (define-module (a) #:use-module (b) #:export (from-a)) (define from-a 1) --8<---------------cut here---------------end--------------->8--- and: --8<---------------cut here---------------start------------->8--- (define-module (b) #:use-module ((a) #:select (from-a)) #:export (from-b)) (define from-b 2) --8<---------------cut here---------------end--------------->8--- This fails: --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> ,use(a) While executing meta-command: ERROR: no binding `from-a' in module (a) --8<---------------cut here---------------end--------------->8--- whereas this succeeds (starting from a fresh Guile): --8<---------------cut here---------------start------------->8--- scheme@(guile-user)> ,use(b) scheme@(guile-user)> from-b $1 =3D 2 --8<---------------cut here---------------end--------------->8--- Problem is that =E2=80=98define-module*=E2=80=99 processes exports after im= ports. What about a patch along these lines: --=-=-= Content-Type: text/x-patch Content-Disposition: inline diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm index c825b35..24b8f4c 100644 --- a/module/ice-9/boot-9.scm +++ b/module/ice-9/boot-9.scm @@ -2872,11 +2872,8 @@ VALUE." (error "expected list of integers for version")) (set-module-version! module version) (set-module-version! (module-public-interface module) version))) - (let ((imports (resolve-imports imports))) (call-with-deferred-observers (lambda () - (if (pair? imports) - (module-use-interfaces! module imports)) (if (list-of valid-export? exports) (if (pair? exports) (module-export! module exports)) @@ -2885,6 +2882,9 @@ VALUE." (if (pair? replacements) (module-replace! module replacements)) (error "expected replacements to be a list of symbols or symbol pairs")) + (let ((imports (resolve-imports module))) + (if (pair? imports) + (module-use-interfaces! module imports))) (if (list-of valid-export? re-exports) (if (pair? re-exports) (module-re-export! module re-exports)) @@ -2896,7 +2896,7 @@ VALUE." ;; handlers. (if (pair? duplicates) (let ((handlers (lookup-duplicates-handlers duplicates))) - (set-module-duplicates-handlers! module handlers)))))) + (set-module-duplicates-handlers! module handlers))))) (if transformer (if (and (pair? transformer) (list-of symbol? transformer)) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: base64 DQpUaGFua3MsDQpMdWRv4oCZLg0K --=-=-=--