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

From: [email-masked] (Ludovic Courtès)
Date: Sun, 22 Apr 2012 12:08:44 +0200

Hi,

Aleix Conchillo Flaqué <[email-masked]> skribis:

> On Sat, Apr 21, 2012 at 4:30 PM, Ludovic Courtès <[email-masked]> wrote:
>>
>> That’s because (ice-9 format) does this evil thing:
>>
>>  (module-set! the-root-module 'format format)
>>
>> In the first run, since the compiler uses (ice-9 format), the global
>> ‘format’ binding pointed to the (ice-9 format) one.  However, in the
>> second run, the global ‘format’ binding pointed to ‘simple-format’,
>> hence the error.
>>
>> Starting from Guile 2.0.5, the ‘format’ compiler warning reports such
>> problems:
>>
>>  scheme@(guile-user)> (format #f "~d" 2)
>>  ;;; <stdin>:1769:0: warning: "~d": unsupported format option ~d, use (ice-9 format) instead
>>
>> The fix is to explicitly import (ice-9 format) in your module.
>>
>> Closing this bug, let us know if anything else is wrong!
>>
>
> Thanks! I guess it's better to start with GUILE_AUTO_COMPILE=0 until
> you are done.

To make sure there’s no misunderstanding: the fix is to import
(ice-9 format) in your module.

> Will this happen with other modules then?

No, (ice-9 format) is the only one that does that AFAIK.

It shouldn’t do this ‘set!’, but removing it is likely to break code
that has come to rely on it, so I guess we’ll have to leave it in.

Thanks,
Ludo’.