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

Re: pretty printer

I'd like to mention that I sent a pretty printer to Bruno and Marcus.
(I presume they're in the archives, but I'll be happy to send another
copy to anyone who wants it.)  It is first of all small and simple
which makes it a good starting point if you want to alter it.  It is
programmable in the usual sense - that you get to say how to treat
lists that start with a given symbol.  It was meant for code, and
solves what I consider annoying problems with other pp's.  All this
is documented in the source.
Now some replies:
  If a pretty-print layout becomes mandatory for every macro, then writing
  macros becomes combersome.
I don't think that this is a requirement for any PP
  It looks ugly when a list containing data which happens to look like
  (LET ...) is printed as if it were a Lisp form. There is no way by which
  the system could decide whether some object is data or program.
The program that prints LET is allowed to look at what's inside.  If the 
form doesn't LOOK like a let form it can print it the default way.  If you
plan to PP data with lists starting with LET then maybe you should instruct
the PP how to recognize them as data.  This could include context, e.g.,
the form that starts the "data" could bind a special variable that would be
read by the LET PP macro.
  Closing parentheses are output just below their corresponding opening
  parenthesis, if *PRINT-RPARS* is T. This makes it much easier for a human
  reader to find out where a certain nesting level ends.
I disagree that it makes anything easier - I think it's a lot uglier.
You can generally tell where a nesting level ends by looking down in the
same column.
  Heavily nested lists and structures tend to reach the right margin very
  quickly in XP. This fact is even recognized by the existence of the variable
  *PRINT-MISER-WIDTH*. And it is not handled satisfactorily in XP: it
  produces lots of lines with much space on the left and only one token
  at the right margin, often exceeding the line length.
This is the main problem (along with the desire for print macros) that
caused me to write the one I sent you.  How does the CLISP PP solve the

  While the *PRINT-CIRCLE* ...
These are not addressed in my PP.