User Tools


Macro PRINT-UNREADABLE-OBJECT

Syntax

  • print-unreadable-object (object stream &key type identity) form*nil

Arguments and Values

Description

Outputs a printed representation of object on stream, beginning with #< and ending with >. Everything output to stream by the body forms is enclosed in the the angle brackets. If type is true, the output from forms is preceded by a brief description of the object's type and a space character. If identity is true, the output from forms is followed by a space character and a representation of the object's identity, typically a storage address.

If either type or identity is not supplied, its value is false. It is valid to omit the body forms. If type and identity are both true and there are no body forms, only one space character separates the type and the identity.

Examples

Note that in this example, the precise form of the output is implementation-dependent.

(defmethod print-object ((obj airplane) stream) (print-unreadable-object (obj stream :type t :identity t) (princ (tail-number obj) stream)))

#<STANDARD-METHOD PRINT-OBJECT (AIRPLANE T) {10024E2943}>

(prin1-to-string my-airplane)

"#<Airplane NW0773 36000123135>"

or "#<FAA:AIRPLANE NW0773 17>"

Affected By

None.

Exceptional Situations

If *print-readably* is true, print-unreadable-object signals an error of type print-not-readable without printing anything.

See Also

None.

Notes

None.

\issue{DATA-IO:ADD-SUPPORT}