The Mindy Object Inspector

Table of Contents


1. Introduction


This document describes the use of the Inspector libraries for Mindy. The Inspector libraries are used to supplement the current Mindy debugger, and provide programmers with a tool for interactively inspecting their data structures. The Inspector has two separate interfaces, a text-based interface and a grpahical interface. The text interface is similar to that of Mindy debugger. The graphical interface offers a pleasant if uninspiring way of inspecting objects; it also offers a rudimentary class diagram viewer.

The Inspector is divided into three libraries, Inspector-Base, Text-Inspector, and X-Inspector. The first of these provides facilities that are common to the other two libraries. The Text-Inspector library implements a text interface to the Inspector and the function inspect. The X-Inspector library implements a graphical interface to the Inspector and the function xinspect. Use of the X-Inspector requires Dylan/TK, which is not available on all systems.

The Inspector is most often invoked via the inspect and xinspect debugger commands. These debugger commands evaluate their arguments and invoke the function inspect or xinspect with the appropriate arguments. The debugger commands will automatically load the appropriate libraries if they have not already been loaded.

2. Inspector-Base


The Inspector-base library exists solely to support the Text-Inspector and X-Inspector libraries. Normal users will not find it useful.

3. Text-Inspector


3.1. Exported Names

inspect [Function]

Arguments
#rest objects
Values
none
Description
The inspect function launches an interactive Inspection session, starting with the object passed in. If no objects were supplied, the Inspector will begin by inspecting $all-libraries (see below). It is an error to pass more than one object to inspect; the #rest args is really just a hack to get "zero or one" semantics. See below for a description of Inspector commands.

$all-libraries [Constant]

This constant magically represents all the libraries currently loaded in Mindy. Inspecting this constant will allow you to peruse libraries, modules, and even named bindings (ie, constants and variables). $all-libraries isn't really useful for anything other than passing to inspect and xinspect.

display-object-info [Function]

Arguments
the-object :: <object>
Values
none
Description
Writes a description of the object to *debug-output* (see mindy.txt for information on *debug-output*). The output is almost the same as that of inspect, except that it is not interactive.

3.2. Text-Inspector Commands

When the text inspector starts, it will display the object you have passed to it, along with all of the information you requested using the keyword flags. Each item will be numbered, and to inspect a sub-object you simply type the number corresponding to the desired choice (in this case, even a superclass is considered a sub-object, because it was inspected via the main object). This lets you move around the object heterarchy, but it is not very convienent. There are additional commands that are designed to allow easier use of the inspector, and these are documented here.

The commands, simply, are as follows:

1, 2, 3, ...
Inspect the subobject corresponding to that number in the current object.
history
Shows the stack of inspected objects
up
Moves up the inspected object stack (i.e. inspects the previous object)
print
Prints the current object using the print function, and the length and level that were passed to inspect.
view
Redisplays the current object (useful if it has gone offscreen)
?, help
Displays a help page much like this
quit, exit
Leaves the inspector and continues program execution

With the exception of history, all commands may be abbreviated by their first letter.

3.3. The History Command

The history command lists all of the previously visited objects in the current session. A sample output may look like this:

    Instance of <my-class>           <--- Initial object, the one given in the argument
    Instance of <sequence>
    Instance of <fixed-integer>
    Class <fixed-integer>
    Class <integer>           <--- Last object seen, the one that "up" goes to
    Class <rational>           <--- The current object

3.4. The Up Command

The up command moves you "up" the history, and lets you see the previously visited object. In the above example, if you moved up twice, the history would look like this:

    Instance of <my-class>
    Instance of <sequence>
    Instance of <fixed-integer>
    Class <fixed-integer>

And you would be inspecting the class <fixed-integer>.

3.5. The Print Command

The print command pretty-prints the current object (using the Gwydion Print library), but does not number the sub-objects. It is useful only for displaying the objects in a different, possible more informative manner.

3.6. The View Command

The view command will allow you to redisplay the object that you are currently inspecting. This is mainly useful if previous commands such as history or view have moved the object off of the screen.

3.7. The Help Command

The help command will display a short help page listing all of the commands and a brief one line description of how they work.

3.8. The Quit and Exit Command

This command (both words mean the same thing) will allow you to leave the inspector and continue with the execution of your program. The next time inspect is called, it will not have any memory of the past session. This means that the history will initially show only the object that you called inspector with. If inspect was invoked from the debugger, you will return to the debugger.

4. X-Inspector


The X-Inspector's graphical interfaace is pretty self explanatory. In addition to offering all the features of the text interface, it also offers a rudimentary class diagram viewer. (The class diagrams are non-interactive--you can click all you want on them, but it won't do anything) The Close button will close a single window; the Quit button will quit Mindy entirely. The X-Inspector library exports the following objects:

xinspect [Function]

Arguments
#rest objects
Values
none
Description
The xinspect function launches an interactive Inspection session, starting with the objects passed in. If no objects were supplied, the Inspector will begin by inspecting $all-libraries (see below). Unlike the inspect function, it is ok to pass multiple objects to xinspect; they will be displayed in separate windows.

$all-libraries [Constant]

This is the same constant as exported from the Text-inspector library.