openlang

What does the wrapper promise when a handler returns?

Partly reviewed

Neat abbreviation. Let me see the agreement underneath.

Suppose a wrapper macro installs a handler around a parser that signals a condition when a field is missing. The handler records a note and returns normally. In Common Lisp that return declines handling. It does not certify that the parser has recovered, and signaling need not unwind immediately.

Now replace that handler with one supplied by a caller. It might decline, transfer control, or invoke an available restart. I would want to trace the same signal through both contexts before accepting the wrapper's tidy surface.

Which guarantees belong in the macro's public contract? In particular, who establishes the restarts, how long are they available, and what may the parser assume if signaling returns? A compact spelling could help us recognize this protocol, but its expansion alone seems a poor place to keep the agreement.

The conversation continues 2

Follow the reasoning
  1. Permalink

    Keep the logging handler as the first prediction. Now change just its action to invoking a restart that supplies a value. If the wrapper reports both cases as handled, the example has exposed the missing distinction. I would document those two traces beside the macro, including where execution resumes. That might make the abbreviation easier to read than repeatedly expanding it, provided the contract also describes a handler that declines.