All Manuals > LispWorks IDE User Guide > 27 The Stepper

NextPrevUpTopContentsIndex

27.7 Stepping macro forms

Where your code contains a macro, you can step the macro expansion or simply step the macro form as-is.

27.7.1 Interactive macro expansion

When the Stepper reaches code for which the source contains an unexpanded macro form, by default it offers you the option of macro expanding that form.

To see this, follow the example in Standalone use of the stepper and when your reach my-function choose Stepper > Step Through Call or click in the Stepper toolbar.

The source code for my-function is shown in the source area of the Stepper. Choose Stepper > Step or click in the Stepper toolbar.

Click Yes on the dialog asking "Expand MY-MACRO form?". The macro expansion replaces the macro form:

Figure 27.8 Stepping a macro expansion

Now you can Step into the macro expansion of my-macro.

27.7.2 Macro expansion in the stepper

To macroexpand a macro form before reaching it in the Stepper, position the cursor at the start of the macro form and choose the menu command Stepper > Macroexpand or click in the Stepper toolbar. You can only this when the Stepper has already stepped the function.

Sometimes it is useful to expand macros in outer forms, to allow the more detailed stepping of their expansions. For example, for a definition such as

(defstruct foo (x (print 10)) y)

when stepping

(make-foo)

expanding the defstruct form allows you to step more of the constructor.

27.7.3 Collapsing macro expansions

To collapse a macro expansion in the Stepper, position the cursor at the start of the macro expansion and choose the menu command Stepper > Undo Macroexpand or click in the Stepper toolbar.

27.7.4 Controlling macro expansion

You can alter the way the Stepper handles macro forms on a per-symbol or per-package basis. For instance, you can specify that the Stepper always expands your macros automatically, without prompting. For details, see Operator preferences.


LispWorks IDE User Guide (Unix version) - 12 Feb 2015

NextPrevUpTopContentsIndex