User Tools


Differences

This shows you the differences between two versions of the page.

Link to this comparison view

cl:macros:print-unreadable-object [2019/08/16 12:00]
cl:macros:print-unreadable-object [2019/12/14 06:00] (current)
Line 1: Line 1:
 +====== Macro PRINT-UNREADABLE-OBJECT ======
 +
 +====Syntax====
 +  * //​print-unreadable-object//​ (//object// //stream// ''&​key''​ //type// //​identity//​) //​form//''​*''​ → **[[CL:​Constant Variables:​nil]]**
 +
 +====Arguments and Values====
 +  * //object// - an //​[[CL:​Glossary:​object]]//;​ evaluated.
 +  * //stream// - a //​[[CL:​Glossary:​stream designator]]//;​ evaluated.
 +  * //type// - a //​[[CL:​Glossary:​generalized boolean]]//;​ evaluated.
 +  * //​identity//​ - a //​[[CL:​Glossary:​generalized boolean]]//;​ evaluated.
 +  * //forms// - an //​[[CL:​Glossary:​implicit progn]]//.
 +
 +====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 //​[[CL:​Glossary:​true]]//,​ the output from //forms// is preceded by a brief description of the //​object//'​s //​[[CL:​Glossary:​type]]//​ and a space character. If //​identity//​ is //​[[CL:​Glossary:​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 //​[[CL:​Glossary:​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 //​[[CL:​Glossary:​implementation-dependent]]//​.
 +
 +<​blockquote> ​
 +([[CL:​Macros:​defmethod]] print-object ((obj airplane) stream) ​
 +  (print-unreadable-object (obj stream :type [[CL:​Constant Variables:​t]] :identity [[CL:​Constant Variables:​t]]) ​
 +    ([[CL:​Functions:​princ]] (tail-number obj) stream)))
 +<​r>#<​STANDARD-METHOD PRINT-OBJECT (AIRPLANE [[CL:​Constant Variables:​T]]) {10024E2943}></​r>​
 +
 +([[CL:​Functions:​prin1-to-string]] my-airplane) ​
 +<​r>"#<​Airplane NW0773 36000123135>"​ </r>
 +<​r>//​or//​ "#<​FAA:​AIRPLANE NW0773 17>"​ </r>
 +</​blockquote>​
 +
 +====Affected By====
 +None.
 +
 +====Exceptional Situations====
 +If **[[CL:​Variables:​star-print-readably-star|*print-readably*]]** is //​[[CL:​Glossary:​true]]//,​ **print-unreadable-object** signals an error of type **[[CL:​Types:​print-not-readable]]** without printing anything.
 +
 +====See Also====
 +None.
 +
 +====Notes====
 +None.
 +
 +\issue{DATA-IO:​ADD-SUPPORT}