From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jean Abou Samra Newsgroups: gmane.lisp.guile.bugs Subject: bug#58109: simple-format vs (ice-9 format) bug in 3.0.7? Date: Sat, 1 Oct 2022 16:14:17 +0200 Message-ID: References: <00542b80-4511-f902-1f8d-a8c5d1645bc3@abou-samra.fr> <6396d555-17fe-dc16-970b-f1075e61131a@abou-samra.fr> <87ill3fyrh.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5168"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.2.1 Cc: christopher.lck@gmail.com, 58109@debbugs.gnu.org, guile-devel@gnu.org To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-X-From: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Sat Oct 01 16:40:42 2022 Return-path: Envelope-to: guile-bugs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oedfV-0001AW-SC for guile-bugs@m.gmane-mx.org; Sat, 01 Oct 2022 16:40:41 +0200 Original-Received: from localhost ([::1]:53072 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oedfU-0001Ks-OW for guile-bugs@m.gmane-mx.org; Sat, 01 Oct 2022 10:40:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40436) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oedGh-0000b7-5v for bug-guile@gnu.org; Sat, 01 Oct 2022 10:15:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46390) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oedGg-0004fK-T1 for bug-guile@gnu.org; Sat, 01 Oct 2022 10:15:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oedGg-0006o7-C5 for bug-guile@gnu.org; Sat, 01 Oct 2022 10:15:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Jean Abou Samra Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Sat, 01 Oct 2022 14:15:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58109 X-GNU-PR-Package: guile Original-Received: via spool by 58109-submit@debbugs.gnu.org id=B58109.166463366826104 (code B ref 58109); Sat, 01 Oct 2022 14:15:02 +0000 Original-Received: (at 58109) by debbugs.gnu.org; 1 Oct 2022 14:14:28 +0000 Original-Received: from localhost ([127.0.0.1]:45468 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oedG7-0006my-HH for submit@debbugs.gnu.org; Sat, 01 Oct 2022 10:14:27 -0400 Original-Received: from mout.kundenserver.de ([212.227.17.24]:34085) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oedG5-0006mk-CU for 58109@debbugs.gnu.org; Sat, 01 Oct 2022 10:14:26 -0400 Original-Received: from [10.188.149.104] ([46.193.67.184]) by mrelayeu.kundenserver.de (mreue107 [212.227.15.184]) with ESMTPSA (Nemesis) id 1MDPuq-1oXWF53zPy-00ARuJ; Sat, 01 Oct 2022 16:14:17 +0200 Content-Language: en-US In-Reply-To: <87ill3fyrh.fsf@gnu.org> X-Provags-ID: V03:K1:G8i9XAWEFb75TAAY1UvLOQ6tAB7fnivJXsYRrYFopbfWIH6olD3 N4Y8ncDbVY8CEUrMhR+ZwQejb4QHbo3xk8Lgr/acqFcaGt3/YEJRHrkatFhAkhgCrzpkXYY K7LFNqcxFYfP2WttyFvrmCdcYtX2bXpNP65Qn+JhEAkuJzLSacyplRQjLVN6o4AEWriKCoJ wuzisyB2/utVrtZD7gABg== X-UI-Out-Filterresults: notjunk:1;V03:K0:TMgxWQC7W7U=:er8XQN9BcoBREa+ND+9jn2 ufsLIhCXwGNi/8ksxtE40yeWUdoCd/6JOXbzP6uQHgj5/aKPbL5OD2obRT3TxR1Fp+Fj3C3uG IHPS4tdbxgPE2ATYXkc/tCeL5GfTsBdJoUh/HLJ05sdPU8pt5+lkbHe2od75xi61LBJuqgyE0 oGm8fq/whPMW1b1e04F19rEGxxBcGadqfLQ1wN92w37EvTcL2SrnSagOywOyDRghMeZgl+eiT zWJTOLxlukBD63+ByRLU+7oomd8VLoZVMSkT87M0IRRn6+h3TEYafREUY9fVw5Xc3p9F5tpAJ Qv9n4i2EOqs2iesw30rhc+wu+EftuODPaB7ObO8j7S5cCwTR8zWuwUNYW6WvzjpHqpRiupTCi YWKKhpyzNKB8cuIOmDWnZ4O89vjfT/nHUeJjqOgiDyqHQFHSEz9M99fjqUMMmNoRdGBSLgW86 BSapyB5rB7sGrEQcUgGiMgzGRQny+gj/4/O5RC0k8F11Ls1mJPQroe8Vj9UhAK+OtomalFlYP 86Er/AwVt9mQTdnMZvcCukRVOsDdah//FjljI6+XXxsWypPLH/iJTI+idrzq4bfclwHCgSmFl z2SdqnpErou9leGQuzHy2+oBlACgvnrHkZlG263RqgJYT2gb/s0wmPAGfnRNmMUmefhWnM6ej xsuY/hZERc/AkfPBKnPvdsnsH6nIk+sslpIlkxwB1GP1jgLXDNCkC0btMdU2FBKYjChvzmrmd XSN0FmrU+zZrRY2VypEelEuYcquNPrsZNXOAkE6jPd6YGUQI08I5iJgwudpOoqfHTjQs0N28 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane-mx.org@gnu.org Original-Sender: "bug-guile" Xref: news.gmane.io gmane.lisp.guile.bugs:10394 Archived-At: Le 01/10/2022 à 15:40, Ludovic Courtès a écrit : > Hi, > > Jean Abou Samra skribis: > >> Uh, at the end of module/ice-9/format.scm, there is >> >> ;; Thanks to Shuji Narazaki >> (module-set! the-root-module 'format format) >> >> which dates back to >> >> commit 14469b7c69feb0f2c5b8a093f19fe2a548b31c5b >> Author: Greg J. Badros >> Date:   Thu Jan 20 20:58:30 2000 +0000 > [...] > >> This probably predates #:replace and could be removed now, right? > Yes, it could be removed, but probably not before the 4.0 series. > > The ‘-Wformat’ warning introduced sometime in the 2.0 or 2.2 series > prepared for that removal by warning about simple-format/format > mismatches, but there’s probably still code out there that assumes > ‘format’ is the full-blown ‘format’, even when (ice-9 format) is not > explicitly imported. OK, understood. How about adding comments and documentation? diff --git a/doc/ref/misc-modules.texi b/doc/ref/misc-modules.texi index 6c899a905..2c00ed859 100644 --- a/doc/ref/misc-modules.texi +++ b/doc/ref/misc-modules.texi @@ -1122,6 +1122,13 @@ you try to use one of them.  The reason for two versions is that the  full @code{format} is fairly large and requires some time to load.  @code{simple-format} is often adequate too. +Beware that when @code{(ice-9 format)} is loaded, it replaces the +binding for @code{format} on the toplevel.  If your module loads +another module that loads @code{(ice-9 format)}, then your module +will see the @code{format} function from @code{(ice-9 format)}, +even if it does not itself import @code{(ice-9 format)}.  This is +legacy behavior and may be removed in a future Guile version. +  @node File Tree Walk  @section File Tree Walk diff --git a/module/ice-9/format.scm b/module/ice-9/format.scm index ee7cba910..026fd9b54 100644 --- a/module/ice-9/format.scm +++ b/module/ice-9/format.scm @@ -32,6 +32,8 @@  (define-module (ice-9 format)    #:autoload (ice-9 pretty-print) (pretty-print truncated-print)    #:autoload (ice-9 i18n)         (%global-locale number->locale-string) +  ;; Actually replaces the global format as soon as loaded; see the end +  ;; of this file.    #:replace (format))  (define format:version "3.0") @@ -83,7 +85,7 @@    ;; format's user error handler    (define (format-error . args)       ; never returns! -    (with-throw-handler #t +    (with-throw-handler #t        (lambda ()          (let ((port (current-error-port)))            (unless (zero? %arg-pos) @@ -1560,5 +1562,10 @@            (close-port port)            str))))) -;; Thanks to Shuji Narazaki +;; Set the format variable in the root module.  This is legacy and +;; no longer necessary.  It means that as soon as (ice-9 format) is +;; loaded somewhere by some module, the predefined binding for format +;; becomes the extended format function, even in modules where (ice-9 format) +;; isn't imported.  Because of this, removing this line should be done +;; when a backwards compatibility break is allowed.  (module-set! the-root-module 'format format) Best, Jean