Changing an inspected object's variables and values
You can also fix errors from a debugger by inspecting an object and then correcting its variables and values. For example, return to the debugger that resulted from evaluating the following expression:
(OrderedCollection new)
at: 4 put: 'Sam'
In Inspecting variables from a debugger, you learned that the ordered collection needs index entries defined in the ordered collection before 'Sam' can be put at index position 4. You can define the index entries and their contents as follows:
Open a Basic Inspector on the variable self of the OrderedCollection>>#at:put: message. In the Basic Inspector, change the value for lastIndex to 4. Next, double-click on the self variable to open an Inspector on the ordered collection.
In the Inspector opened on self, change the values for some of its variables to the following:
1
'Alix'
2
'Sam'
3
4
4
(Date today), which displays a date when you save the change
If you now select self in the debugger, the value changes to OrderedCollection('Alix' 'Sam' 4 <date> ).
Finally, to change the value for index position 4, evaluate self at: 4 put: 'Steven'. You can evaluate this in the value pane of the Inspector. Or, you can evaluate it in the description or value panes of the debugger.
The value for the self variable now displays the collection ('Alix' 'Sam' 4 'Steven' ).
For more information on changing the values of variables, see Changing variables.
Last modified date: 10/12/2017