Subject: bug#11293: format and simple-format confused after compiling

From: Aleix Conchillo Flaqué <[email-masked]>
Date: Fri, 20 Apr 2012 23:43:46 -0700

Hi,

today I just got a weird issue (probably my fault). I'm trying to
write a very basic Guile cookbook for beginners, which is the ony
think I know in any case.

Anyway, I have this script:

#!/usr/bin/guile -s
!#

(simple-format #t "my first message with a new line~%")

(format #t "my first ~a message with a number ~d and a new line~%"
           "formatted" 1)

If you execute it for the first time (or after being edited) it
returns the right thing:

;;; note: source file /home/aleix/src/guile/guile-cookbook/recipe-3/recipe-3.scm
;;;       newer than compiled
/home/aleix/.cache/guile/ccache/2.0-LE-8-2.0/home/aleix/src/guile/guile-cookbook/recipe-3/recipe-3.scm.go
;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
;;;       or pass the --no-auto-compile argument to disable.
;;; compiling /home/aleix/src/guile/guile-cookbook/recipe-3/recipe-3.scm
;;; compiled /home/aleix/.cache/guile/ccache/2.0-LE-8-2.0/home/aleix/src/guile/guile-cookbook/recipe-3/recipe-3.scm.go
my first message with a new line
my first formatted message with a number 1 and a new line

However, if I execute it a second time without modifying the file I get:

my first message with a new line
my first formattedBacktrace:
In ice-9/boot-9.scm:
 157: 7 [catch #t #<catch-closure 1aee9c0> ...]
In unknown file:
   ?: 6 [apply-smob/1 #<catch-closure 1aee9c0>]
In ice-9/boot-9.scm:
  63: 5 [call-with-prompt prompt0 ...]
In ice-9/eval.scm:
 407: 4 [eval # #]
In ice-9/boot-9.scm:
2189: 3 [save-module-excursion #<procedure 1aed340 at
ice-9/boot-9.scm:3724:3 ()>]
3731: 2 [#<procedure 1aed340 at ice-9/boot-9.scm:3724:3 ()>]
In unknown file:
   ?: 1 [load-compiled/vm
"/home/aleix/.cache/guile/ccache/2.0-LE-8-2.0/home/aleix/src/guile/guile-cookbook/recipe-3/recipe-3.scm.go"]
   ?: 0 [simple-format #t ...]

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

It seems to me that simple-format is saved in the compiled file,
instead of format.

Is this normal? Did I do anything wrong? The other question I had is
that I did not include "(use-modules (ice-9 format))" and it seems
included by default:

Enter `,help' for help.
scheme@(guile-user)> format
$1 = #<procedure 26aaae0 at ice-9/format.scm:1612:9 (destination
format-string . args) | (deprecated-format-string-only)>

I'm running 2.0.5.90-c0580.

Thanks,

Aleix