4 The MLWorks Interactive Environment Library

4.9 Inspecing values: the Inspector structure

This section examines the Shell commands for invoking an MLWorks TTY version of the inspector. Note that the TTY inspector can be invoked in the GUI environment's listener, which means that it is available on Windows as well as UNIX. For an explanation of the GUI inspector tool, see section 1.8 of this manual and Chapter 4 of the MLWorks User Guide.

The TTY inspector allows you to navigate the value being inspected recursively. At each stage it prints a numbered list of subvalues of the current value. It supports the following commands:

<field name>
Inspect named field of current value

p
Inspect parent value of current

q
Quit.

The Inspector structure provides functions for adding and deleting inspector methods. Briefly, an inspector method is a function of type t1 -> t2 that will be applied whenever an object of type t1 is being inspected. On subsequent inspection, values of type t1 are inspected as if they were of type t2. Note that inspector methods must be compiled in debugging mode.

If a method is added then the inspector assumes that the method handles the printing and recursive navigation of the relevant data structure.

structure Inspector:
  sig
    exception InspectError of string
    val addInspectMethod: ('a -> 'b) -> unit
    val deleteAllInspectMethods: unit -> unit
    val deleteInspectMethod: ('a -> 'b) -> unit
    val inspectIt: unit -> unit
  end
InspectError
addInspectMethod
deleteInspectMethod
deleteAllInspectMethods
inspectIt

MLWorks Reference Manual (version 1.0) - 3 DEC 1996

Generated with Harlequin WebMaker