I cleaned up some old VisualWorks code I had from Ernest Micklei and published it to the Cincom Public Repository. Watch out for a "Teachable" package.
It's another nice example how powerfull Smalltalk really is. It's an implementation of a Teachable class who's instances can be teached to respond to messages. It's usefull for creating mocks who should behave like other objects (for instance inside of a test case) without actually implementing a real mock class. Here is an example how it can be used:
teachable := Teachable new.
whenSend: #help return: 'ok';
whenSend: #doit evaluate: [1 inspect];
whenSend: #negate: evaluate: [:num num negated].
After teaching the object we can use it as if it had a normal implementation in a class:
teachable help. "this will return the string 'ok'"
teachable doit. "this will open the inspector on the SmallInteger 1"
teachable noDebugger. "this will accept the send of #noDebugger and return the teachable"
teachable negate: 120 "this will return -120"
A Squeak version of the code can be found here.