deprecate passing a number as the destination to `format'
authorAndy Wingo <wingo@pobox.com>
Sat, 28 Aug 2010 20:43:46 +0000 (13:43 -0700)
committerAndy Wingo <wingo@pobox.com>
Sat, 28 Aug 2010 20:44:00 +0000 (13:44 -0700)
* module/ice-9/format.scm (format): Deprecate having a number as the
  destination.
* doc/ref/misc-modules.texi (Formatted Output): Update docs.

doc/ref/misc-modules.texi
module/ice-9/format.scm

index 6cd0ad2..e17f985 100644 (file)
@@ -159,9 +159,8 @@ instead of @nicode{%}, and are more powerful.
 @deffn {Scheme Procedure} format dest fmt [args@dots{}]
 Write output specified by the @var{fmt} string to @var{dest}.
 @var{dest} can be an output port, @code{#t} for
-@code{current-output-port} (@pxref{Default Ports}), a number for
-@code{current-error-port}, or @code{#f} to return the output as a
-string.
+@code{current-output-port} (@pxref{Default Ports}), or @code{#f} to
+return the output as a string.
 
 @var{fmt} can contain literal text to be output, and @nicode{~}
 escapes.  Each escape has the form
index c802f29..6520a60 100644 (file)
              (cond
               ((or (and (boolean? destination) ; port output
                         destination)
-                   (output-port? destination)
-                   (number? destination))
+                   (output-port? destination))
                (format:out (cond
                             ((boolean? destination) (current-output-port))
                             ((output-port? destination) destination)
                             ((number? destination) (current-error-port)))
                            (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
                     (not destination))
                (call-with-output-string