emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#15540: closed (Circular module imports vs. #:selec


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#15540: closed (Circular module imports vs. #:select (2.0.9))
Date: Tue, 28 Feb 2017 10:51:02 +0000

Your message dated Tue, 28 Feb 2017 11:50:00 +0100
with message-id <address@hidden>
and subject line Re: bug#15540: Circular module imports vs. #:select (2.0.9)
has caused the debbugs.gnu.org bug report #15540,
regarding Circular module imports vs. #:select (2.0.9)
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden)


-- 
15540: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=15540
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: Circular module imports vs. #:select (2.0.9) Date: Sun, 06 Oct 2013 21:36:42 +0200 User-agent: Gnus/5.130007 (Ma Gnus v0.7) Emacs/24.3 (gnu/linux)
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 = 2
--8<---------------cut here---------------end--------------->8---

Problem is that ‘define-module*’ 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 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))
Thanks,
Ludo’.

--- End Message ---
--- Begin Message --- Subject: Re: bug#15540: Circular module imports vs. #:select (2.0.9) Date: Tue, 28 Feb 2017 11:50:00 +0100 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)
On Sun 06 Oct 2013 21:36, address@hidden (Ludovic Courtès) 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 = 2
>
> Problem is that ‘define-module*’ processes exports after imports.

Applied a version of your patch to master.  Making the test was quite
tricky!

Andy


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]