This is the mail archive of the guile@sourceware.cygnus.com mailing list for the Guile project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [bug] format in script


Shuji Narazaki <narazaki@cs.cis.nagasaki-u.ac.jp> writes:

> Hi,
> 
> Scheme-version format (in the CVS guile) doesn't work in script mode:
> 
> $ cat test-format
> #!/usr/local/bin/guile -s
> !#
> (use-modules (ice-9 format))
> (format #t "~A ~a\n" "REPLACED" "replaced")
> $ ./test-format
> REPLACED ~a
> $ 
> 
> And the following patch seems to fix it (why?):

Because boot-9.scm does:

(define format simple-format)

so just doing:

(define format format:format)

creates a new binding in a different module instead of changing the old
one.  I'll let a module guru comment further and decide what the best
fix is for the present, and how the new module system will affect the
discussion.

Thanks for finding this problem;  it's definitely something I should've
tested. :-(

Greg


> 
> Index: ice-9/format.scm
> ===================================================================
> RCS file: /cvs/guile/guile/guile-core/ice-9/format.scm,v
> retrieving revision 1.3
> diff -u -r1.3 format.scm
> --- format.scm	1999/09/11 17:51:09	1.3
> +++ format.scm	2000/01/17 06:12:46
> @@ -1670,7 +1670,8 @@
>  
>  (define format:abort (lambda () (error "error in format")))
>  
> -(define format format:format)
> +;(define format format:format)
> +(variable-set! (builtin-variable 'format) format:format)
>  
>  ;; If this is not possible then a continuation is used to recover
>  ;; properly from a format error. In this case format returns #f.
> ------------
> 
> regards,
> -- 
> narazaki

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]