STANDARD-INPUT-INITIAL-BINDING*STANDARD-INPUT*, *STANDARD-OUTPUT*, *ERROR-OUTPUT*, *TRACE-OUTPUT*, *QUERY-IO*, and *DEBUG-IO* are initially bound to synonym streams to *TERMINAL-IO*. This requirement hampers the integration of Common Lisp with many existing and potential operating environments.
For example, a Unix implementation is currently unable to legally support Unix standard error output even though Common Lisp defines *ERROR-OUTPUT* because *ERROR-OUTPUT* is required to start out bound to the same stream as *STANDARD-OUTPUT*. A workstation environnment which provides stream access to windows as an extension is currently forbidden to make trace output appear in a separate window by default because *TRACE-OUTPUT* is required to start out bound to the same stream as *STANDARD-OUTPUT*.
*TERMINAL-IO* *STANDARD-INPUT* *STANDARD-OUTPUT* *ERROR-OUTPUT* *TRACE-OUTPUT* *QUERY-IO* *DEBUG-IO*
The initial bindings of these variables are undefined except that: 1. They are all initially bound to open streams. 2. The streams must support input and/or output as indicated by the variable name. 3. None of the standard streams (including *TERMINAL-IO*) may be directed by synonym streams to another of these stream variables (except *TERMINAL-IO*), whether directly or by indirection via some composite stream such as a two way stream with one of the arms being a synonym stream. 4. Any or all of these streams may be synonyms for the common implementation dependent stream. For example, in an interactive Common Lisp invocation running on a character terminal, all of the streams mentioned here might be synonym streams (or two-way streams to synonym streams) to a pair of hidden terminal input/output streams maintained by the implementation.
The intent of the above rules is to ensure that it is always safe to bind any of the above variables to another of the above variables without unduly restricting implementation flexibility.
PROGN (PRINT "Output" *STANDARD-OUTPUT*) (PRINT "Error" *ERROR-OUTPUT*))
In current Common Lisp will write: ------ Output Error ------
With proposal *might* write: ------ Output ------ and "Error" appears somewhere else.
(LET ((*STANDARD-OUTPUT* *DEBUG-IO*)) ...)
In current Common Lisp: Might cause a circular stream reference if *DEBUG-IO* was bound to a two-way stream made up of synonym streams to *STANDARD-INPUT* and *STANDARD-OUTPUT*.
With this proposal: Would be guaranteed not to cause a circular stream reference unless the initial value of *DEBUG-IO* had been changed to a value that did not conform the restrictions in this proposal. While no Common Lisp implementation should do this, a user program might.
(LET ((*STANDARD-INPUT* *TERMINAL-IO*) (*STANDARD-OUTPUT* *TERMINAL-IO*)) ...)
In current Common Lisp: Might cause a circular stream reference because *TERMINAL-IO* was bound to a two-way stream made up of synonym streams to *STANDARD-INPUT* and *STANDARD-OUTPUT*.
With this proposal: Would be guaranteed not to cause a circular stream reference.
*TERMINAL-IO* to a special internal stream type. Franz binds *TERMINAL-IO* to a special internal stream type for terminal streams which reads from Unix standard input and writes to Unix standard output. KCL binds *TERMINAL-IO* to a standard two-way-stream with input from Unix standard input and output to Unix standard output. Symbolics Genera binds *TERMINAL-IO* as appropriate for each process, usually to a window for interactive applications or to a stream which will conjure an interaction window on demand for background tasks.IO behavior to their environment and their user's expectations.*TERMINAL-IO* (and, by extension, *QUERY-IO*, and *DEBUG-IO*) should fail to work in a non-interactive environment where nothing like a terminal exists. This proposal fails to address this.
Masinter notes that: ``In many multi-processing multi-window environments, the "initial binding" for *STANDARD-INPUT*, *QUERY-INPUT* differs for each process.''
Pierson and Pitman support STANDARD-INPUT-INITIAL-BINDING:DEFINED-CONTRACTS.