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

Re: Issue: PRINT-PRETTY-HOOK (version 1)



    I thought at one time that extensions to prettyprint were going to be
    handled as specializations to a standard generic function in the same
    way that print-object is specializable. I'd like at least to make sure
    that this is present.
    
I very much want this to be present, but it's inadequate for two reasons:
1 CLOS may not be a required part of Common Lisp, therefore portable code
  may not be able to assume it.
2 Writing a separate pretty printer for each structure using standard
  Common Lisp functions is likely to be much more verbose than doing
  the same job using one of Dick Water's pretty printers.  Of course
  some people will find the extension syntax of Dick's pretty
  printers distasteful, but I'm proposing to standardize on them.

    There's too much that the prettyprinter needs to do "right" that a
    portable prettyprinter can't do, that I wonder if this really solves
    the problem. That is "while it is easy for a user to write a pretty
    printer" is it really easy for a user to write a correct pretty
    printer? One that can deal with *print-circle*, for example?

There may be things that a user written pretty printer can't do right
(though I can't think of any) but *PRINT-CIRCLE* support certainly
isn't one of them as long as the pretty printer starts at the top
(i.e. changing from one printer to another at say, level 3, will break
circular printing for any two independent print functions).  I put
full *PRINT-CIRCLE* support into the VAX Lisp version of GPRINT; doing
it as efficiently as possible was a bit of work, but it didn't require
any non user visible support (printing things like structures did
require implementation dependent functions, but that's being addressed
by a separate proposal).  Remember that the pretty printer can always
punt to PRINx-TO-STRING for atoms it doesn't understand.