print-object (original) (raw)

ANSI Common Lisp 22 Printer 22.4 Dictionary of Printer

22.4.11 print-object Standard Generic Function

Syntax:

print-object object stream object

Method Signatures:

print-object (object standard-object) stream

print-object (object structure-object) stream

Arguments and Values:

object - an object.

stream - a stream.

Description:

The generic function print-object writes the printed representation of _object_to stream. The function print-object is called by the Lisp printer; it should not be called by the user.

Each implementation is required to provide a method on the class standard-object and on the class structure-object. In addition, each implementation must provide methods on enough other classes_so as to ensure that there is always an applicable method. Implementations are free to add methods for other classes. Users may write methods for print-object for their own_classes if they do not wish to inherit an implementation-dependent method.

The method on the class structure-object prints the object in the default #S notation; see Section 22.1.3.12 Printing Structures.

Methods on print-object are responsible for implementing their part of the semantics of the printer control variables, as follows:

If these rules are not obeyed, the results are undefined.

In general, the printer and the print-object methods should not rebind the print control variables as they operate recursively through the structure, but this is implementation-dependent.

In some implementations the stream argument passed to a print-object method is not the original stream, but is an intermediate stream that implements part of the printer.methods should therefore not depend on the identity of this stream.

See Also:

pprint-fill,pprint-logical-block,pprint-pop,write,*print-readably*,*print-escape*,*print-pretty*,*print-length*, Section 22.1.3 Default Print-Object Methods, Section 22.1.3.12 Printing Structures, Section 22.2.1.4 Pretty Print Dispatch Tables, Section 22.2.2 Examples of using the Pretty Printer

Allegro CL Implementation Details:

None.