[plt-scheme] Structure Inspectors

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sun Jun 8 11:38:18 EDT 2003

At 08 Jun 2003 04:29:07 -0500, Ed Cavazos wrote:
> Is there any way to make newly created struct types automatically
> inspectable, without specifying the (make-inspector) argument to
> define-struct? The docs say that inspectors are mainly intended for
> debuggers. Is the idea that a debugger would instrument any instances
> of define-struct with an additional (make-inspector) arg?

The default inspector for a new struct type is `(current-inspector)'.
The idea is that a debugger would create a new inspector for the
debuggee and install it as `current-inspector' before running the
debuggee. Later, the debugger can use its own inspector to view the
content of debuggee structs.

In short, wrap code with

  (parameterize ([current-inspector (make-inspector)])
     ...)

to make its structs transparent.

Matthew



Posted on the users mailing list.