Subject: (ice-9 format) undesirably loaded when compiling

From: Jean Abou Samra <[email-masked]>
Date: Sat, 14 Aug 2021 19:35:28 +0200

Hello,

Please have a look at the following session:

$ cat bug.scm
(format #t "~f\n" 42)
$ guile --no-auto-compile bug.scm
Backtrace:
            1 (primitive-load "/home/jean/repos/guile/bug.scm")
            0 (simple-format #t "~f\n" 42)

ERROR: In procedure simple-format:
In procedure simple-format: FORMAT: Unsupported format option ~f - use 
(ice-9 format) instead
$ guile bug.scm
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /home/jean/repos/guile/bug.scm
;;; compiled 
/home/jean/.cache/guile/ccache/3.0-LE-8-4.4/home/jean/repos/guile/bug.scm.go
42.0
$ guile bug.scm
Backtrace:
In ice-9/boot-9.scm:
   1752:10  6 (with-exception-handler _ _ #:unwind? _ # _)
In unknown file:
            5 (apply-smob/0 #<thunk 7fac89889f40>)
In ice-9/boot-9.scm:
     724:2  4 (call-with-prompt ("prompt") #<procedure 7fac8988b420 …> …)
In ice-9/eval.scm:
     619:8  3 (_ #(#(#<directory (guile-user) 7fac89880c80>)))
In ice-9/boot-9.scm:
    2835:4  2 (save-module-excursion #<procedure 7fac89870150 at ice-…>)
   4380:12  1 (_)
In unknown file:
            0 (simple-format #t "~f\n" 42)

ERROR: In procedure simple-format:
In procedure simple-format: FORMAT: Unsupported format option ~f - use 
(ice-9 format) instead

As you can see, during the run where compilation
is performed, (ice-9 format) is loaded in the
main environment without being asked for, making
the program execution different, which is somewhat
confusing and error-prone as a program that has been
tested once will no longer work the next time
(thus possibly escaping an automated testing
system).

This is with Guile 3.0.5.130-5a1e7.

Thanks for your attention,
Jean Abou Samra