Next: , Previous: Methods, Up: Top


6 Printing

The following procedures can be used to define a custom printed representation for an instance. It is highly recommended that instances be printed by write-instance-helper, as this ensures a uniform appearance for all objects.

— Generic Procedure: write-instance instance port

This is called by the runtime system to generate the printed representation of instance. The methods of this procedure should write the representation to port.

— Procedure: write-instance-helper name instance port thunk

This writes a standardized “frame” for a printed representation method. It generates the following output on port:

          #[name hash-number...]
     

where hash-number is the result of calling hash on instance, and ... is the output generated by thunk.