[pro] Default behavior of standard output streams

Martin Simmons martin at lispworks.com
Tue May 22 17:29:28 UTC 2012


>>>>> On Tue, 22 May 2012 10:58:27 +0200, Didier Verna said:
> 
>   Hello,
> 
> there is a discrepancy amongst compilers on how the default output streams
> behave in some situations. Consider the following test case:
> 
> (format *standard-output* "This goes to standard output.~%")
> (format *error-output* "This goes to error output.~%")
> (format *query-io* "This goes to query io.~%")
> 
> 
> Now, launch you favorite Lisp on a terminal and load this file at
> startup in 3 different ways:
> 
> myfavoritelisp --the-load-option test.lisp
> myfavoritelisp --the-load-option test.lisp > log
> myfavoritelisp --the-load-option test.lisp > log 2>&1
> 
> 
> SBCL and CMUCL behave in a way which I think is right:
> case #1: everything is printed on the terminal
> case #2: stdout goes in the file
> case #3: stdout and stderr go in the file (*query-io* stays on the tty)
> 
> ECL redirects the output of *query-io* in the file for cases #2 and #3.
> The behavior of stdout and stderr is the same as in SBCL and CMUCL.
> 
> Finally, LW, ACL, CLISP, CCL and ABCL redirect everything in the file in
> cases #2 and #3.
> 
> 
> I'm ready to fill in bug reports for the last 6 compilers, but are these
> really bugs? I'm convinced that it is for stderr, but it may be arguable
> for *query-io*.
> 
> WDYT?

It's a feature request, not a bug (the ANSI standard even says that it is
common for the initial values of *error-output* and *standard-output* be the
same stream).

IMHO, having two independently-buffered streams connected to the same
underlying destination in the interactive case #1 is a recipe for confusion.

-- 
Martin Simmons
LispWorks Ltd
http://www.lispworks.com/




More information about the pro mailing list