2.8 Sheet, Stream, or Medium Arguments to Macros

There are many macros that take a sheet, stream, or medium as one of the arguments, for example, with-new-output-record and formatting-table. In CLIM, this argument must be a variable bound to a sheet, stream, or medium; it may not be an arbitrary form that evaluates to a sheet, stream, or medium. t and sometimes nil are usually allowed as special cases; this causes the variable to be interpreted as a reference to another stream variable (usually *standard-output* for output macros, or *standard-input* for input macros). Note that, while the variable outside the macro form and the variable inside the body share the same name, they cannot be assumed to be the same reference. That is, the macro is free to create a new binding for the variable. Thus, the following code fragment will not necessarily affect the value of stream outside the formatting-table form: [annotate]

(formatting-table (stream)
  (setq stream some-other-stream)
  ...)

Furthermore, for the macros that take a sheet, stream, or medium argument, the position of that variable is always before any forms or other "inputs". [annotate]