[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Recursive printing proposal
Date: Fri, 22 Nov 1985 14:26 EST
From: "Scott E. Fahlman" <Fahlman@C.CS.CMU.EDU>
I think this would have to be a special form and not a macro, since it
cannot be implemented using existing forms.
It could be introduced as a function which took a printer continuation. A macro
could then be written by anyone who didn't like functional notation.
It might be better to add a function to sense and setf the current print depth,
and implement your own macro in terms of that.
I'd agree with adding such primitives, but I don't think this is a good way to
think about a toplevel printing abstraction. What if some day we decide there
is more to toplevel printing than just noticing when the depth gets reset to
zero. Better to have an abstraction which does "any necessary setup" for printing
a toplevel object.
I'm not sure that this is a good abstraction to have, but if we have it, I think
that these thoughts are relevant.
I do know that I think we should have had an INVOKE-TOPLEVEL-READER abstraction
rather than passing around recursive-p information.
I guess I'd be willing to consider a function like the following:
PRINT-OBJECT-TOPLEVEL OBJECT &KEY FUNCTION STREAM
which could be described to do something roughly like the following, plus any
system-specific stuff which didn't interfere with the basic idea ... whatever
that means (sigh) ...
(DEFUN PRINT-OBJECT-TOPLEVEL (OBJECT &KEY FUNCTION STREAM)
(LET ((*STANDARD-OUTPUT* (OR STREAM *STANDARD-OUTPUT*)))
(LET ((OLD-DEPTH (CURRENT-PRINT-DEPTH *STANDARD-OUTPUT*)))
(UNWIND-PROTECT (PROGN (SETF (CURRENT-PRINT-DEPTH *STANDARD-OUTPUT*) 0)
(FUNCALL (OR FUNCTION #'PRIN1) OBJECT))
(SETF (CURRENT-PRINT-DEPTH *STANDARD-OUTPUT*) OLD-DEPTH)))))