[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Recursive printing.

The proposal:

  " ... that a depth be maintained for every stream, and that WRITE to
    a stream should increment that stream's depth at entry and restore
    the depth on exit"

assumes that it is never the case that someone will want to start a new top
level print on a stream when there is printing in progress.

Incrementing a counter upon entry to WRITE will not handle the situation where
someone interrupts pretty printing and enters a break loop.  Printing done
during the break loop should not be done as if it were nested within the pretty
print, it should be done as though it were at top level.  How can this be
expressed without explicitly initiating a new top level print?

Without a way of explicitly starting a new top level print some heuristic
must be used to attempt to determine when a new top level print is started
within a recursive print.  A good rule of thumb is that the use of a new stream
signals the start of a new top level print.

Dan's two astronaut print provides an example where the stream switch
heuristic fails.  The break loop case provides an example where incrementing
the internal depth counter whenever WRITE is entered fails.  The problem is
that we lack a mechanism for explicitly stating that a new top level print
is desired.  Adding RECURSIVE-P give us this mechanism (although it does
not address the problem presented by FORMAT).