Oddly enough, we just discussed it on the Squeak irc channel. Maybe take a look at ObjectViewer.
In your example, you want to intercept sending messages to SmallInteger. Oddly enough, ObjectViewer works with every BUT SmallInteger class.
So, to intercept sending messages to myObject, do this.
Create an Intercepter class, let it inherit ObjectTracer, perhaps. Changing doesNotUnderstand to something that helps you:
doesNotUnderstand: aMessage
"do Mojo to aMessage as you describe it"
Then, to get your stuff, create your Intercepter:
myIntercepter := Intercepter on: myObject.
And then
myObject become: myInterceptor.
source
share