1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-21 20:20:24 +02:00

deprecate passing a number as the destination to `format'

* module/ice-9/format.scm (format): Deprecate having a number as the
  destination.
* doc/ref/misc-modules.texi (Formatted Output): Update docs.
This commit is contained in:
Andy Wingo 2010-08-28 13:43:46 -07:00
parent 877514dab0
commit c89920a71f
2 changed files with 8 additions and 5 deletions

View file

@ -159,9 +159,8 @@ instead of @nicode{%}, and are more powerful.
@deffn {Scheme Procedure} format dest fmt [args@dots{}] @deffn {Scheme Procedure} format dest fmt [args@dots{}]
Write output specified by the @var{fmt} string to @var{dest}. Write output specified by the @var{fmt} string to @var{dest}.
@var{dest} can be an output port, @code{#t} for @var{dest} can be an output port, @code{#t} for
@code{current-output-port} (@pxref{Default Ports}), a number for @code{current-output-port} (@pxref{Default Ports}), or @code{#f} to
@code{current-error-port}, or @code{#f} to return the output as a return the output as a string.
string.
@var{fmt} can contain literal text to be output, and @nicode{~} @var{fmt} can contain literal text to be output, and @nicode{~}
escapes. Each escape has the form escapes. Each escape has the form

View file

@ -167,13 +167,17 @@
(cond (cond
((or (and (boolean? destination) ; port output ((or (and (boolean? destination) ; port output
destination) destination)
(output-port? destination) (output-port? destination))
(number? destination))
(format:out (cond (format:out (cond
((boolean? destination) (current-output-port)) ((boolean? destination) (current-output-port))
((output-port? destination) destination) ((output-port? destination) destination)
((number? destination) (current-error-port))) ((number? destination) (current-error-port)))
(car arglist) (cdr arglist))) (car arglist) (cdr arglist)))
((number? destination)
(issue-deprecation-warning
"Passing a number to format as the destination is deprecated."
"Pass (current-error-port) instead.")
(format:out (current-error-port) (car arglist) (cdr arglist)))
((and (boolean? destination) ; string output ((and (boolean? destination) ; string output
(not destination)) (not destination))
(call-with-output-string (call-with-output-string