
Chapter 2: Analysis 2
1 Motivation
The Common Lisp standard mandates the existence of several streams such as *STANDARD-
OUTPUT*, *ERROR-OUTPUT* and *QUERY-IO*. The purpose of these streams, however, is only
informally described, leading to implementation-specific behavior.
This can be problematic for Lisp sessions started from a terminal (without a graphical user
interface) and standalone command-line executables. As illustrated in the next section, the
current behavior of some standard output streams, notably with respect to shell redirection
may not only be different across implementations, but also contrary to the user’s expectations.
The purpose of this document is hence to illustrate the problem and suggest that all Common
Lisp implementations agree on one particular scheme (one actually already adopted by two of
them).
2 Analysis
In order to analyze the effects of these underspecifications, some tests were conducted on 8
Common Lisp implementations on May 28th 2012, with the help of the code snippet depicted
below.
(format *standard-output* "This goes to standard output.~%")
(format *error-output* "This goes to error output.~%")
(format *query-io* "This goes to query io.~%")
This code was stored in a test file, and loaded in three different stream redirection contexts.
Care was taken to avoid launching any graphical user interface for implementations providing
them. The contexts were as follows (adapt the exact command-line settings to every tested
implementation):
cl --quit --load test.lisp
cl --quit --load test.lisp > log
cl --quit --load test.lisp > log 2>&1
The results of these tests are depicted in the table below. They exhibit 3 different sets of
behaviors.
Compiler Test case #1 Test case #2 Test case #3
SBCL std-output -> tty std-output -> log std-output -> log
CMU-CL err-output -> tty err-output -> tty err-output -> log
query-io -> tty query-io -> tty query-io -> tty
ECL std-output -> tty std-output -> log std-output -> log
err-output -> tty err-output -> tty err-output -> log
query-io -> tty query-io -> log query-io -> log
CLISP std-output -> tty std-output -> log std-output -> log
CCL err-output -> tty err-output -> log err-output -> log
ABCL query-io -> tty query-io -> log query-io -> log
LispWorks
Allegro