Next Previous Up Top Contents Index

4 The Printing Modules

4.1 Introduction

The IO library's printing modules provide an interface that outputs an object in Dylan literal syntax if the object can be represented as a Dylan literal, and otherwise, outputs the object in an implementation-dependent manner. There are two functions, print and print-object. The print function accepts keyword arguments that form a print request, controlling features such as circular printing, how deep within a data structure to print, how many elements in long sequences to print before using an ellipsis notation, whether pretty printing is desired, and so on. Users extend print's ability to print various objects by adding methods to the print-object function. The print function handles most of the overhead to satisfy special print requests, outputting any special notations required, and it only calls print-object when it is necessary to print objects. Users should always call the print function to output objects, especially recursively from within print-object methods to output an object's components. Users should never call print-object directly.

The IO library exports two modules for use with printing, print and pprint. Reference entries for the interfaces exported from the print module can be found in Section 4.4 on page 18, and reference entries for interfaces exported from the pprint module are in Section 4.5 on page 23.

These modules uses the Streams module. See Chapter 5 for full details of the Streams module.


System and I/O Reference - 31 MAR 2000

Next Previous Up Top Contents Index