GNU bug report logs -
#38895
Autoloads behave differently in Guile ≥ 2.9.7
Previous Next
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.
Full log
View this message in rfc822 format
[Message part 1 (text/plain, inline)]
Your message dated Sun, 12 Jan 2020 21:23:55 +0100
with message-id <87ftgko23o.fsf <at> pobox.com>
and subject line Re: bug#38895: Autoloads behave differently in Guile ≥ 2.9.7
has caused the debbugs.gnu.org bug report #38895,
regarding Autoloads behave differently in Guile ≥ 2.9.7
to be marked as done.
(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)
--
38895: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=38895
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
[Message part 3 (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 4 (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 5 (text/plain, inline)]
The new semantics make sense, but I would rather err on the side of
compatibility.
WDYT?
Thanks,
Ludo’.
[Message part 6 (message/rfc822, inline)]
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
This bug report was last modified 5 years and 194 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.