print

There are two unrelated print functions.

Summary
There are two unrelated print functions.
Prints an object on a stream in literal notation.
Prints an object to STDOUT in a simple literal notation.

Generic Functions

print

Prints an object on a stream in literal notation.

Prints object to stream according to the print request formed by the keyed arguments.  A first call to print creates a printing stream to represent the print request, and recursive calls to print on this printing stream process the keyed arguments differently (see below).  There are inspection functions for querying the print request (see Module print).  When print actually prints an object, it calls print-object.  Though variables allow you to inspect any parameter of the print request, print-object methods should only need to inspect *print-length*.  All other aspects of the print request are handled by print.  There is one exception which is described in the PPrint module (pretty-printing).

level: controls how deep into a nested data structure to print.  The value #f indicates that there is no limit.  Recursive calls to print may change the value of *print-level* explicitly, but print always uses a value to ensure the print request formed by the first call to print is never exceeded.  For example, if a first call to print set the level to 5, and while at a depth of 3, a recursive call specified a level of 4, the recursive call would only descend 2 more levels, not 4.

length: controls how many elements of a sequence to print before printing ellipsis notation (…).  The value #f indicates that there is no limit.  The *print-length* control can be interpreted loosely by some print-object methods to control how many elements of any kind of object to print; for example, the default <object> method might regard *print-length* to determine how many slot-name/value pairs to print.  Recursive calls to print may change the value of *print-length* explicitly, but they may only decrease the value, never increase it.

circle?: indicates whether printing should check all subcomponent references to make sure the printing process does not infinitely recurse through a data structure.  Circular printing also tags objects that occur more than once when they are first printed, and later occurrences are printed as a reference to the previously emitted tag.  If *print-circle?* is already #t, then it remains #t throughout all recursive calls.  If *print-circle?* is #f, then recursive calls to print can change the value to #t; however, when printing exits the dynamic scope of the call that changed the value to #t, the value reverts to #f.  If the original call to print specifies circle?: as #f, and dynamically distinct recursive calls turn circular printing on and off, all output generated while circular printing was on shares the same tagging space; that is, if X is printed twice, once from each of two distinct recursive calls to print, then each X is guaranteed to signify the identical object.

pretty?: indicates whether printing should attempt to insert line breaks and indentation to format objects according to how programmers tend to find it easier to read data.  If *print-pretty?* is already #t, then it remains #t throughout all recursive calls.  If *print-pretty?* is #f, then recursive calls to print can change the value to #t; however, when printing exits the dynamic scope of the call that changed the value to #t, the value reverts to #f.

Exported from

Modifiers

sealed

Arguments

objectAn instance of <object>.
streamAn instance of <stream>.
level:An instance of <integer> or #f.  Holds the maximum depth to which the user wants recursive printing to go.  Optional.
length:An instance of <integer> or #f.  Holds the maximum number of elements of a sequence the user wants printed.  This does not apply to some sequences, such as strings.  Optional.
circle?:An instance of <boolean>.  Defines print behavior when printing a circular list.  Optional.
pretty?:An instance of <boolean>.  Whether the user wants pretty printing.  Optional.
escape?:An instance of <boolean>.  Whether the user wants to print strings and characters with quotes and visible escape codes.  Optional.

Functions

print

Prints an object to STDOUT in a simple literal notation.

Exported from

Arguments

argAn instance of <object>.
There are two unrelated print functions.
This module provides 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.
The default way to print objects.
The current length value for the print request.
Gives how far down recursively to print.
The class of all Dylan objects.
Specifies whether circular printing is on.
Specifies whether pretty printing is on.
The superclass of all stream classes.
The class of integers.
The class of boolean values.
This module exports some basic, unextendable input and output functionality.