From unknown Mon Aug 18 09:03:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15540: Circular module imports vs. #:select (2.0.9) 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: To: 15540@debbugs.gnu.org X-Debbugs-Original-To: bug-guile@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.138108853221954 (code B ref -1); Sun, 06 Oct 2013 19:43:02 +0000 Received: (at submit) by debbugs.gnu.org; 6 Oct 2013 19:42:12 +0000 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 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 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 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 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 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 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 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 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) 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) 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) From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) 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 Date: Sun, 06 Oct 2013 21:36:42 +0200 Message-ID: <877gdqqjhx.fsf@gnu.org> User-Agent: Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" 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-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) --=-=-= 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 --=-=-=-- From unknown Mon Aug 18 09:03:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15540: Circular module imports vs. #:select (2.0.9) Resent-From: Ian Price Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 08 Oct 2013 20:02:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15540 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Cc: 15540@debbugs.gnu.org Received: via spool by 15540-submit@debbugs.gnu.org id=B15540.13812625014527 (code B ref 15540); Tue, 08 Oct 2013 20:02:01 +0000 Received: (at 15540) by debbugs.gnu.org; 8 Oct 2013 20:01:41 +0000 Received: from localhost ([127.0.0.1]:35715 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VTdTR-0001Aw-2L for submit@debbugs.gnu.org; Tue, 08 Oct 2013 16:01:41 -0400 Received: from mail-we0-f178.google.com ([74.125.82.178]:64831) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1VTdTO-0001Ak-Cp for 15540@debbugs.gnu.org; Tue, 08 Oct 2013 16:01:38 -0400 Received: by mail-we0-f178.google.com with SMTP id q59so9199012wes.37 for <15540@debbugs.gnu.org>; Tue, 08 Oct 2013 13:01:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=ZFqoaZaNowD1mQB2uy9FNwIeaExKTD/PXfGgf320roM=; b=YLqxQ4j/f9APFP9g69rMBGBLDNP2svp8AiCe3PAJ40pibr53I2ePe57xzRS1+CVMsd VPRYfeTJv6ysVlGTe09UEk1X8guDxHzbxqy/ch1NOMjrCCns2d8xbRutR3BAPXoPqKwa q/76uohNP+x3Qj3mTc4mM+oQjc8ymLmJmAWMNeYddeU9P++sA7JVlL3276GBEqYoUARh qs2dgkLEy6zsHoi21D4NAjoCyPiarkGUB3Q7A4IfVK5ZDsc1DgQmadjObg2HEmc8qn9c LgGoe1Hl1KLFFDSfI+mddFIavOtOjQxgeZR23S5wSfTZ57aZA5Tm5hBeL99bP5rb5Hry 6FRg== X-Received: by 10.194.20.202 with SMTP id p10mr3262185wje.39.1381262497260; Tue, 08 Oct 2013 13:01:37 -0700 (PDT) Received: from Kagami.home (host86-132-92-201.range86-132.btcentralplus.com. [86.132.92.201]) by mx.google.com with ESMTPSA id k4sm4717981wic.0.1969.12.31.16.00.00 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 08 Oct 2013 13:01:36 -0700 (PDT) From: Ian Price References: <877gdqqjhx.fsf@gnu.org> Date: Tue, 08 Oct 2013 21:01:31 +0100 In-Reply-To: <877gdqqjhx.fsf@gnu.org> ("Ludovic \=\?iso-8859-1\?Q\?Court\=E8s\?\= \=\?iso-8859-1\?Q\?\=22's\?\= message of "Sun, 06 Oct 2013 21:36:42 +0200") Message-ID: <87y563bkh0.fsf@Kagami.home> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: -0.4 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.4 (/) Looks fine to me. Maybe it's worth adding a comment to the source to mention why we do it that way. And of course, a test so we don't break it in the future. :) -- Ian Price -- shift-reset.com "Programming is like pinball. The reward for doing it well is the opportunity to do it again" - from "The Wizardy Compiled" From unknown Mon Aug 18 09:03:53 2025 X-Loop: help-debbugs@gnu.org Subject: bug#15540: Circular module imports vs. #:select (2.0.9) Resent-From: Andy Wingo Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Tue, 21 Jun 2016 11:09:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 15540 X-GNU-PR-Package: guile X-GNU-PR-Keywords: To: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Cc: guix-devel@gnu.org, 15540@debbugs.gnu.org Received: via spool by 15540-submit@debbugs.gnu.org id=B15540.146650733526177 (code B ref 15540); Tue, 21 Jun 2016 11:09:01 +0000 Received: (at 15540) by debbugs.gnu.org; 21 Jun 2016 11:08:55 +0000 Received: from localhost ([127.0.0.1]:48621 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFJY7-0006o9-3Z for submit@debbugs.gnu.org; Tue, 21 Jun 2016 07:08:55 -0400 Received: from pb-sasl1.pobox.com ([64.147.108.66]:61436 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bFJY6-0006o2-2X for 15540@debbugs.gnu.org; Tue, 21 Jun 2016 07:08:54 -0400 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-sasl1.pobox.com (Postfix) with ESMTP id A5FC2221F1; Tue, 21 Jun 2016 07:08:52 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; s=sasl; bh=2WpaB+KKgnID +/K1x/G+eFyIMfw=; b=vxXSlm6eskdOzt1iZOatxicYvTNbF6338nMB+ul5+U/K +lmgHmZpyo+3QW5TMAx+/QWapBBcyntL0QRtUh2vXAMgj6SR6D5NGdYisIft8bFC UtKow3K7Mjb58EQLNrKvwIcHoWLzBfpKWMQc3aA2oqCydULeECqLj63hBiraXRc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; q=dns; s=sasl; b=dOTBy4 ku9fuutoA6wQzOQCkS+uER0gXmR7KLDqgtI8uEv+ccEnwvWSPqAmE1aD3YLYfHnD wjR1LO80ggVVNLtn3Bvz4DAvyu4GFZ6eEJoBEKpMKbbBOtVDMWZ6Vf7ki2vKXcfd GGDEFl/77My2GGJ4VQEG7Bjg69aG1c2uwsqU8= Received: from pb-sasl1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-sasl1.pobox.com (Postfix) with ESMTP id 9F46B221F0; Tue, 21 Jun 2016 07:08:52 -0400 (EDT) Received: from clucks (unknown [88.160.190.192]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by pb-sasl1.pobox.com (Postfix) with ESMTPSA id CCE33221EF; Tue, 21 Jun 2016 07:08:51 -0400 (EDT) From: Andy Wingo References: <877gdqqjhx.fsf@gnu.org> Date: Tue, 21 Jun 2016 13:08:44 +0200 In-Reply-To: <877gdqqjhx.fsf@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Sun, 06 Oct 2013 21:36:42 +0200") Message-ID: <87y45y2403.fsf@pobox.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Pobox-Relay-ID: 896B5FDC-37A0-11E6-AEEA-C1836462E9F6-02397024!pb-sasl1.pobox.com X-Spam-Score: -1.4 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.4 (-) Yes! As Ian notes this needs a test case. Some kind Guixer should fix up this patch and send to Guile so that it lands before we release 2.0.12, which should come any day now :-) Andy On Sun 06 Oct 2013 21:36, ludo@gnu.org (Ludovic Court=C3=A8s) writes: > Consider these two modules: > > (define-module (a) #:use-module (b) #:export (from-a)) > (define from-a 1) > > and: > > (define-module (b) #:use-module ((a) #:select (from-a)) #:export (from-b)) > (define from-b 2) > > This fails: > > scheme@(guile-user)> ,use(a) > While executing meta-command: > ERROR: no binding `from-a' in module (a) > > whereas this succeeds (starting from a fresh Guile): > > scheme@(guile-user)> ,use(b) > scheme@(guile-user)> from-b > $1 =3D 2 > > Problem is that =E2=80=98define-module*=E2=80=99 processes exports after = imports. > > What about a patch along these lines: > > 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 symb= ol 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))))) >=20=20 > (if transformer > (if (and (pair? transformer) (list-of symbol? transformer)) > > Thanks, > Ludo=E2=80=99. From unknown Mon Aug 18 09:03:53 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) Subject: bug#15540: closed (Re: bug#15540: Circular module imports vs. #:select (2.0.9)) Message-ID: References: <874lzepp2f.fsf@pobox.com> <877gdqqjhx.fsf@gnu.org> X-Gnu-PR-Message: they-closed 15540 X-Gnu-PR-Package: guile Reply-To: 15540@debbugs.gnu.org Date: Tue, 28 Feb 2017 10:51:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1488279062-4953-1" This is a multi-part message in MIME format... ------------=_1488279062-4953-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #15540: Circular module imports vs. #:select (2.0.9) which was filed against the guile package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 15540@debbugs.gnu.org. --=20 15540: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D15540 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1488279062-4953-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 15540-done) by debbugs.gnu.org; 28 Feb 2017 10:50:13 +0000 Received: from localhost ([127.0.0.1]:59108 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cifMC-0001Gl-SG for submit@debbugs.gnu.org; Tue, 28 Feb 2017 05:50:13 -0500 Received: from pb-sasl2.pobox.com ([64.147.108.67]:56194 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cifMA-0001Gb-TA for 15540-done@debbugs.gnu.org; Tue, 28 Feb 2017 05:50:11 -0500 Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-sasl2.pobox.com (Postfix) with ESMTP id 05ED35D85F; Tue, 28 Feb 2017 05:50:10 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; s=sasl; bh=307ukwlIKPae rgJZbZyL4Mf3Tqk=; b=HcEpuXlQNL7tbF26SyWwXdbLGARffDFVXGK0VgQSeETg gZSkKkAwpUWN1X0qSL2An/JPsfoOq5S71VPOf8+eN7IuXte3+FNbf3ljEOc/ZGMh JApbTCFsRn6EyhOuYyeFm2lleRWB7yS5u/LXAiDKn5y/MSAmP6T+EVhdXsXJho8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type:content-transfer-encoding; q=dns; s=sasl; b=CDCl9E hiNioe0e4P67RaqFYW5znwJOJIgRWJtliKRKfFOlZ20iBsN+xoXSmVRnbpiUvuUJ 11McHNTlCWN4e71NeikSGjso7mYxVartFyoOOOo3JhCsbSn9EoDv74R8JFp0xJjr dOh0yVt34uMxHINZPiEyrMuTKeD+6TgENa06I= Received: from pb-sasl2.nyi.icgroup.com (unknown [127.0.0.1]) by pb-sasl2.pobox.com (Postfix) with ESMTP id D9F595D85B; Tue, 28 Feb 2017 05:50:09 -0500 (EST) Received: from clucks (unknown [88.160.190.192]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by pb-sasl2.pobox.com (Postfix) with ESMTPSA id D186A5D85A; Tue, 28 Feb 2017 05:50:08 -0500 (EST) From: Andy Wingo To: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: bug#15540: Circular module imports vs. #:select (2.0.9) References: <877gdqqjhx.fsf@gnu.org> Date: Tue, 28 Feb 2017 11:50:00 +0100 In-Reply-To: <877gdqqjhx.fsf@gnu.org> ("Ludovic =?utf-8?Q?Court=C3=A8s=22'?= =?utf-8?Q?s?= message of "Sun, 06 Oct 2013 21:36:42 +0200") Message-ID: <874lzepp2f.fsf@pobox.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Pobox-Relay-ID: AC15164E-FDA3-11E6-8FB4-6141F2301B6D-02397024!pb-sasl2.pobox.com X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 15540-done Cc: 15540-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.0 (/) On Sun 06 Oct 2013 21:36, ludo@gnu.org (Ludovic Court=C3=A8s) writes: > Consider these two modules: > > (define-module (a) #:use-module (b) #:export (from-a)) > (define from-a 1) > > > and: > > (define-module (b) #:use-module ((a) #:select (from-a)) #:export (from-b)) > (define from-b 2) > > > This fails: > > scheme@(guile-user)> ,use(a) > While executing meta-command: > ERROR: no binding `from-a' in module (a) > > > whereas this succeeds (starting from a fresh Guile): > > scheme@(guile-user)> ,use(b) > scheme@(guile-user)> from-b > $1 =3D 2 > > Problem is that =E2=80=98define-module*=E2=80=99 processes exports after = imports. Applied a version of your patch to master. Making the test was quite tricky! Andy ------------=_1488279062-4953-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 6 Oct 2013 19:42:12 +0000 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 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 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 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD autolearn=disabled version=3.3.2 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 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 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 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 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) 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) 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) From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) To: bug-guile@gnu.org Subject: Circular module imports vs. #:select (2.0.9) 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 Date: Sun, 06 Oct 2013 21:36:42 +0200 Message-ID: <877gdqqjhx.fsf@gnu.org> User-Agent: Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" 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-Received-From: 2001:4830:134:3::11 X-Spam-Score: -5.0 (-----) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -5.0 (-----) --=-=-= 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 --=-=-=-- ------------=_1488279062-4953-1--