Inspecting variables from a debugger
To inspect a variable, select it and then select Inspect from the Inspector menu. Or, if the variable is not followed by an ellipsis (...), simply double-click on the variable.
For the message OrderedCollection>>#at:put:, the variables and their values are as follows:
Variable
Value
self
OrderedCollection()
anInteger
4
anObject
'Sam'
These are the values in the expression that generated the error. They indicate that the string 'Sam' should be at index position 4 in the ordered collection.
Now select Basic Inspect from the Inspector menu. The values for the variables firstIndex and lastIndex shown in the Basic Inspector are both zero (0), indicating that there are no entries in the ordered collection. Unless an ordered collection has entries, you cannot access any indexes. So, the cause of the error was attempting to place an object at index 4 before this index was defined.
Had you evaluated an expression such as the following, the at:put: message would not have failed because the ordered collection contains four entries and defines index position 4.
(OrderedCollection new)
add: 'Alix';
add: 'Sam';
add: 4;
add: (Date today);
at: 4 put: 'Steven';
yourself.
Displaying this expression returns OrderedCollection('Alix' 'Sam' 4 'Steven' ).
Correcting errors from a debugger describes other ways to correct the error.
Last modified date: 01/29/2015