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

prettyprinting



Easy questions, but not of trivial consequence for those of us who
intend to produce human-readable files:

    Is there some way to redirect PP's output?
    Is there some way to change PP's left margin?

Harder question:

    What are the future plans for PP?  I would hope that the real one
    will have convenient hooks for the user, data-driven by particular
    function names.  TLisp makes it fairly easy to control indentation
    in expression-units, e.g., you can easily say that DE should have
    the format

        (DE name arg_list
         body)

    or

        (DE name arg_list
            body)

    i.e., indent under DE or under name, although you have to drop
    to user code to get something like

        (DE name arg_list
          body)

    i.e., indent 2 spaces.  On the other hand, (SPRINT exp left_margin)
    makes the user code fairly straightforward.

    TLisp's PP has another feature that's useful; you can specify that
    (name exp) prettyprint as <character>exp, i.e., an inverse
    readmacro.  Since many readmacros, including ', behave this way,
    it can make PP'ed forms much more readable.  However, it can make
    some straightforward implementations of PP quite
    non-straightforward, since short expressions that fit on one line
    can no longer be just printed, and the size of an expression is
    not its FLATSIZE.

    Drew says he has worked out a fairly nice prettyprinter.  Perhaps
    it can be converted.
-------