Macro hiding

The macro stepper, by default, does not show the expansion of macros defined in the mzscheme language or imported from other libraries. For example, the macro stepper doesn’t show that define expands into define-values, and it doesn’t show that when expands into if and begin. Of course, it still shows the expansion of the right-hand side of a definition and the condition and body expressions of a when expression.

3.1  Customizing macro hiding

You can customize the behavior of the macro stepper in this regard by disabling macro hiding entirely or by customizing the modules or individual macros it hides.

The macro hiding panel is hidden by default. Show it by selecting “Show/hide macro hiding configuration” from the “Stepper” menu. That will add the configuration panel to the bottom of the macro stepper frame.

The default policy enables macro hiding and hides all macros from the mzscheme language and all macros imported through (require (lib ---)) and (require (planet ---)).

You may change the policy by selecting an identifier in the syntax display and then clicking one of "Hide module", "Hide macro", or "Show macro" in the configuration panel. The new rule appears in the policy list. You may remove it by selecting it in the list and clicking the “Delete” button.

Disabling macro hiding makes the stepper show the expansion of all macros. It also reveals additional details about macro expansion in mzscheme. With macro hiding disabled, the stepper will show internal definition blocks being rewritten to letrec expressions, begin forms being spliced into module or block bodies, and other such steps.1

Changes to the checkboxes on the left-hand side of the panel are persistent: future sessions with the macro stepper will use the last options you saved by default. Rules about specific modules and macros are not persistent.

3.2  Limitations

There are also limitations to the kinds of macros that the stepper can perform hiding on. The following kinds of macros cannot be hidden:

When macro hiding is enabled and the macro stepper encounters one of those sorts of macros, it will emit a warning and try to continue to apply macro hiding to the unaffected part of the program. In some cases, it will emit an error and switch off macro hiding entirely.

Future releases of the macro stepper should eliminate some of these limitations.

1 Disabling macro hiding is a good way to learn about the implementation of many mzscheme syntactic forms and the way that macro expansion really works.