Eclipse Lisp: The Real-Eval-Print Loop and Debugger


The top-level read-eval-print loop, the debugger (invoke-debugger, break, and error), the inspector (inspect) and the single-stepper (step) all use the same real-eval-print loop.

In all cases except for the top-level, forms are read from *debug-io*, evaluated, and the results printed on *debug-io*. For the top-level, forms are read from *standard-input* and the results printed on *standard-output*. The form to be evaluated is prompted for using the function which is the value of *prompt-hook*.

When a new read-eval-print loop is entered, the condition which caused entry to the loop is printed on *error-output*, with *print-escape* bound to NIL. If the condition is a subtype of error, warn or break, the corresponding condition class name is also printed in a stylized, readable way (eg. simple-type-error => Type Error:).

The read-eval-print loop notes any available restarts that correspond (as though by (compute-restarts condition)) to the condition which caused entry to the loop. If any such restarts are available, they are printed to the output stream (i.e. *standard-output* or *debug-io*,) after the condition notice.

When a restart is used to abort one read-eval-print loop to return to an earlier one, the error notice and restarts for the earlier read-eval-print loop are reprinted.

Most forms entered at the read-eval-print loop prompt are evaluated in a null lexical environment, as though by eval. There are two exceptions:

  1. Normally, an integer evaluates to itself, which is not very interesting. However, an integer that corresponds to the number printed in the listing of available restarts is used to invoke that restart interactively.
  2. Normally, a keyword evaluates to itself, which is not very interesting. However, a keyword that is the same as the name of one of the available restarts is used to interactively invoke the first such such restart listed.
Note that these exceptions are for the interactive read-eval-print loop only, not for the function eval.

If a command is given to invoke a restart interactively through the debugger, and the restart returns zero or more values rather than transferring control, the values are printed and treated like those returned by any form evaluated in the loop.

The form and value variables such as +, *, and / are special variables and are not rebound by different read-eval-print levels.


[Previous] [Next] [Up] [Documentation Contents] [Eclipse Home Page]