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

Re: pretty printing



        From:    Stanley Letovsky <Letovsky>
        Subject: pretty printing

        I notice that the pretty-printer is 1 or 2 orders of magnitude
        slower than print:  ...  could you give me a pointer to the source
        code?

    The T pretty-printer is nearly the most simple-minded, inefficient
    pretty-printer imaginable, and intentionally so.  It would not need
    to be this way if someone were to trouble to write an efficient
    version, but that is quite difficult.

[An old speech:]

I would hate to see someone waste their time on the current T
pretty-printer.  By the time you finished putting your "last" hack into
the T pretty-printer, you could have completely ported GPRINT, an excellent
pretty printer that the Lisp Machines and other systems use.  GPRINT is
by far the best overall pretty printer I have seen.  It is both very
efficient and sophisticated.  It does user-controlled elision and circular
structure detection, and it is easy to write new print methods for
particular object types (it is much more extensible than the UCI/Rutgers
printer).

The ELI project used it as our DEFAULT top-level printer for over a year
in MACLISP, and we were very pleased.  It is amazing how having an eliding
pretty-printer changes your interactive programming style.  Now when I
hear people say they have no need of a pretty-printer for every-day use,
I'm reminded of the people who used to say they had no need for line
editors -- you don't know what you're missing.  Once you've done it once,
you never want to go back.

Porting GPRINT into T would be very straightforward for any good
programmer.  The version we had in MACLISP was about 2000 lines long,
and while not written in the best style, it wasn't that bad either.  Common
Lisp people have mentioned porting it to Common Lisp; perhaps by now
someone has done so.

A good starting point for finding out about GPRINT would be the article
by Waters in the most recent TOPLAS.
-------