[slime-devel] Re: REPL-specific printer control variables

Nikodemus Siivola nikodemus at random-state.net
Wed May 24 07:25:45 UTC 2006

"Robert J. Macomber" <slime at rojoma.com> writes:

> This patch adds two variables to swank: *listener-print-level* and
> *listener-print-length*, analogous to the standard Lisp variables
> *print-level* and *print-length*, used to control how much of a form's
> return values get printed at the REPL but not of things printed
> directly by user code.  If they're bound (by default, they aren't)
> then swank uses them when preparing the presentation of an
> evaluation's result for sending to Emacs.  When they're unbound, the
> values of the standard CL depth and length variables instead.

While I symphatize with the motivation, I also strongly disagree with
this patch on two grounds:

 1. *PRINT-LEVEL* &co are the right tools to use for affecting the
    REPL. If your code assumes magic values of *PRINT-LEVEL* it is
    more-or-less broken, and should bind them explicitly, for which
    you will find WITH-STANDARD-IO-SYNTAX convenient.

 2. If this really really must go in, please let us make it 
    *PRESENTATION-PRINT-ALIST* instead, and use a PROGV:

     (let ((bindings (reverse *listener-print-alist*)))
       (progv (mapcar #'car bindings) (mapcar #'cdr bindings)

    This way when someone needs *PRINT-RADIX* or similar they don't have
    to add and document another variable.


  -- Nikodemus              Schemer: "Buddha is small, clean, and serious."
                   Lispnik: "Buddha is big, has hairy armpits, and laughs."

More information about the slime-devel mailing list