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

Readtables and prin1



    Date: Wed, 17 Sep 1986  21:07 EDT
    From: "Scott E. Fahlman" <Fahlman@C.CS.CMU.EDU>

    I think that the usual practice is to print things out so that they can
    be read in using the standard readtable.  It would be VERY difficult to
    write code that can print out text for any user-modified readtable,
    especially if the read-table contains macros.

Many systems attempt to print things out so that they can be read in using
the current readtable.  For example, the Symbolics system uses the current
readtable to determine where escape characters are required (feed the
symbol's name back through the readtable and see if you get the same thing).
I agree that it is very difficult to cope with arbitrary user modifications
to the readtable, especially with the readtable-modifying primitives provided
by Common Lisp, but on the other hand it's easy to cope with some common,
simple modifications such as changing exclamation point from a constituent
to a macro.  Basing this on the current readtable rather than the standard
readtable gives the user more flexibility, but as Common Lisp is currently
defined it is up to each implementation to decide whether it wants to go
to this much care.

I think if we're going to be more specific than "an attempt is made to
print an expression in such a way that it can be read again", then it
is incumbent on us to define more specifically how to customize the
printer in the same way that the reader can be customized, e.g. changing
the parenthesis characters.