GNU bug report logs - #38895
Autoloads behave differently in Guile ≥ 2.9.7

Previous Next

Package: guile;

Reported by: Ludovic Courtès <ludo <at> gnu.org>

Date: Fri, 3 Jan 2020 15:58:01 UTC

Severity: normal

Done: Andy Wingo <wingo <at> pobox.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 38895 in the body.
You can then email your comments to 38895 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to wingo <at> igalia.com, bug-guile <at> gnu.org:
bug#38895; Package guile. (Fri, 03 Jan 2020 15:58:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Ludovic Courtès <ludo <at> gnu.org>:
New bug report received and forwarded. Copy sent to wingo <at> igalia.com, bug-guile <at> gnu.org. (Fri, 03 Jan 2020 15:58:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: bug-Guile <at> gnu.org
Subject: Autoloads behave differently in Guile ≥ 2.9.7
Date: Fri, 03 Jan 2020 16:56:57 +0100
[Message part 1 (text/plain, inline)]
Hello!

It seems that since 2.9.7, autoloads have to specify exactly all the
bindings of the autoloaded module that the user will ever reference.
Bindings that are omitted from the #:autoload clause remain unbound:

--8<---------------cut here---------------start------------->8---
ludo <at> ribbon /tmp [env]$ cat a.scm
(define-module (a)
  #:export (foo bar))

(define foo 42)
(define bar 43)
ludo <at> ribbon /tmp [env]$ cat b.scm
(define-module (b)
  #:autoload (a) (foo))

(pk '-> foo)
(pk '=> bar)
ludo <at> ribbon /tmp [env]$ guild compile -Wunbound-variable -L . b.scm
b.scm:5:0: warning: possibly unbound variable `bar'
wrote `/home/ludo/.cache/guile/ccache/3.0-LE-8-4.1/tmp/b.scm.go'
ludo <at> ribbon /tmp [env]$ guile -L . -l b.scm -q
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling ./a.scm
;;; compiled /home/ludo/.cache/guile/ccache/3.0-LE-8-4.1/tmp/a.scm.go

;;; (-> 42)
Backtrace:
In ice-9/boot-9.scm:
  1722:10  6 (with-exception-handler _ _ #:unwind? _ # _)
In unknown file:
           5 (apply-smob/0 #<thunk 7f976447aa40>)
In ice-9/boot-9.scm:
    718:2  4 (call-with-prompt _ _ #<procedure default-prompt-handle…>)
In ice-9/eval.scm:
    619:8  3 (_ #(#(#<directory (guile-user) 7f9764071f00>)))
In ice-9/boot-9.scm:
   2792:4  2 (save-module-excursion _)
  4336:12  1 (_)
In b.scm:
      5:0  0 (_)

b.scm:5:0: Unbound variable: bar
ludo <at> ribbon /tmp [env]$ guile --version
guile (GNU Guile) 2.9.8
--8<---------------cut here---------------end--------------->8---

That’s different from previous Guile behavior:

--8<---------------cut here---------------start------------->8---
ludo <at> ribbon /tmp$ guild compile -Wunbound-variable -L . b.scm
wrote `/home/ludo/.cache/guile/ccache/2.2-LE-8-3.A/tmp/b.scm.go'
ludo <at> ribbon /tmp$ guile -L . -l b.scm -q
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling ./a.scm
;;; compiled /home/ludo/.cache/guile/ccache/2.2-LE-8-3.A/tmp/a.scm.go

;;; (-> 42)

;;; (=> 43)
GNU Guile 2.2.6
Copyright (C) 1995-2019 Free Software Foundation, Inc.
--8<---------------cut here---------------end--------------->8---

Reverting cb14fd214365e50b6b1655616ae74d0228933bbd solves the problem,
or simply applying this change:

[Message part 2 (text/x-patch, inline)]
diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm
index b602de228..adbf5ba5d 100644
--- a/module/ice-9/boot-9.scm
+++ b/module/ice-9/boot-9.scm
@@ -3420,7 +3420,7 @@ error if selected binding does not exist in the used module."
   (let ((b (lambda (a sym definep)
              (false-if-exception
               (and (memq sym bindings)
-                   (let ((i (resolve-interface name #:select bindings)))
+                   (let ((i (module-public-interface (resolve-module name))))
                      (unless i
                        (error "missing interface for module" name))
                      (let ((uses (memq a (module-uses module))))
[Message part 3 (text/plain, inline)]
The new semantics make sense, but I would rather err on the side of
compatibility.

WDYT?

Thanks,
Ludo’.

Reply sent to Andy Wingo <wingo <at> pobox.com>:
You have taken responsibility. (Sun, 12 Jan 2020 20:25:01 GMT) Full text and rfc822 format available.

Notification sent to Ludovic Courtès <ludo <at> gnu.org>:
bug acknowledged by developer. (Sun, 12 Jan 2020 20:25:02 GMT) Full text and rfc822 format available.

Message #10 received at 38895-close <at> debbugs.gnu.org (full text, mbox):

From: Andy Wingo <wingo <at> pobox.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 38895-close <at> debbugs.gnu.org
Subject: Re: bug#38895: Autoloads behave differently in Guile
 ≥ 2.9.7
Date: Sun, 12 Jan 2020 21:23:55 +0100
On Fri 03 Jan 2020 16:56, Ludovic Courtès <ludo <at> gnu.org> writes:

> It seems that since 2.9.7, autoloads have to specify exactly all the
> bindings of the autoloaded module that the user will ever reference.
> Bindings that are omitted from the #:autoload clause remain unbound:

Indeed.  This was an unintentional change, in the sense that I thought
that the previous behavior was to only import the referenced bindings.
As discussed on IRC we decided to leave it with the new behavior, add a
NEWS entry, and we can roll back if it's really a pain to people.
Thanks for finding the issue!

Andy




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 10 Feb 2020 12:24:09 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 48 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.