7 Using MLWorks in TTY Mode

7.4 Inspecting values in the TTY interface

The TTY interface provides its own interface to the inspector, though it can also be invoked in the GUI environment via the listener.

The TTY inspector inspects the value of it, whatever that may be at the time the inspector is invoked. To invoke the inspector, call the built-in interactive environment function Shell.Inspector.inspectIt. For example:

MLWorks> [["a", "b"], ["c", "d"]];
val it : string list list = [["a", "b"], ["c", "d"]]

MLWorks> Shell.Inspector.inspectIt(); Entering TTY inspector - enter ? for help Value: [["a", "b"], ["c", "d"]] Type: string list list 0: ["a", "b"] 1: ["c", "d"] Inspector>

The TTY inspector allows you to navigate the value being inspected recursively. As you can see, 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.

To continue our example:

Inspector> 0
Value: ["a", "b"]
Type: string list
0: "a"
1: "b"
Inspector> 1
Value: "b"
Type: string
Inspector> p
Value: ["a", "b"]
Type: string list
0: "a"
1: "b"
Inspector> q
val it : unit = ()
MLWorks> 

The TTY inspector supports inspector methods. Inspector methods allow you to apply a function whenever a value of a particular type is inspected. You could, for example, control the printing style for values of certain types your application defines. Inspector methods must be compiled in debugging mode. For more on inspector methods, see the section on Shell.Inspector in the MLWorks Reference Manual.


MLWorks User Guide (UNIX version 1.0) - 3 DEC 1996

Generated with Harlequin WebMaker