6.8.3 Looking at Objects

When you are chasing an error, it is often helpful to
examine the instance variables of your objects. While
strategic calls to printNl will no doubt help, you can look at an
object without having to write all the code yourself. The
inspect message works on any object, and dumps out the
values of each instance variable within the object.1

We'll finish this chapter by emphasizing a technique
which has already been covered: the use of the error:
message in your own objects. As you saw in the case of Dictionary,
an object can send itself an error: message with a
descriptive string to abort execution and dump a stack backtrace.
You should plan on using this technique in your own
objects. It can be used both for explicit user-caused
errors, as well as in internal sanity checks.

Footnotes

[1] When using
the Blox GUI, it actually pops up a so-called Inspector window.