STEP-ENVIRONMENTSTEP is evaluated. Some people think it's supposed to be evaluated in the null environment, others think it is supposed to be evaluated in the current environment, the one in which the STEP form was evaluated.
The same considerations apply to TIME.
STEP and TIME evaluate the form in the current environment.
2. Clarify that calls to both STEP and TIME may be compiled, but that in the case of STEP, it is acceptable for an implementation to interactively step through only those parts of the computation that are interpreted.
;Assuming X is not a special variable (setq x 1) (let ((x 2)) (step (print x)))
This should print and return 2, not 1, when interpreted.
STEP and TIME than to reset to the null environment.
2. Although STEP is primarily a debugging tool, there is no reason to prevent it from being compiled correctly.
STEP as a special form and does not allow it to be compiled.
Eric Benson contributed the definition of TIME in Lucid Common Lisp:
(defmacro time (form) `(time-internal #'(lambda () ,form)))
The function TIME-INTERNAL looks something like:
(defun time-internal (thunk) (let ((before-time (get-time-state))) (unwind-protect (funcall thunk) (print-time-information before-time (get-time-state)))))
The definition of STEP is similar. This is just to show that it is easy to get the right lexical environment even though TIME and STEP are macros.
VaxLisp expands STEP into something like:
(defmacro step (form) `(let ((*eval-hook* #'step-command-loop)) ,form))
Additional comments:
Verbally this was explained to mean that the body of the STEP would not be stepped when compiled, but if it just happened to call an interpreted function, that function would get stepped.