Comment 2 for bug 541584

Revision history for this message
Douglas Katzman (dougk) wrote :

This behavior is a consequence of *evaluator-mode* being :compile.
The REPL tries to use an extremely rudimentary evaluation strategy to avoid calling the compiler.
The first thing that it has to do to try interpreting a form is to macroexpand it, accounting for one call of TEST2.

For a variety of reasons the simplistic evaluator will give up, and call the compiler, which it does using the original form.
In this case it's a SETQ of an unknown variable that is not handled by the simple evaluator, so it then calls the compiler on the original form, which has to be expanded again.
If Y had been DEFVAR'ed, the simple evaluator would have done the SETQ and not called the compiler.

As Nikodemus remarked, this is permissible behavior. With *evaluator-mode* = :interpret, only one macroexpansion occurs.
Basically not a bug.