On Jan 21, 2008 1:59 PM, Keith Hodges <
[hidden email]> wrote:
> SystemNavigation allObjectDo:
>
> gets upset, when one of its objects turns out to be an instance of
> ProtoObject subclass: MessageCatcher.
I do, too. MessageCatcher instances are evil. It's hard to do anything
with one without tripping over something it doesn't understand,
especially #hash.
For example, evaluating the following in a Workspace works for me, but
then it bollixes the Workspace so that I can't do it a second time,
because the workspace chokes on its former variable fred:
fred := MessageCatcher new.
count := 0.
SystemNavigation default allObjectsDo: [:i |
( i class == MessageCatcher)
ifTrue: [count := count + 1]].
count inspect
>From looking at how it's used in the system, it seems to be used only
to catch the messages sent by
InstructionStream>>interpretNextInstructionFor:, which is to say that
the only messages it needs to catch are listed explicitly in that
method. It looks like a hack that could be avoided entirely by
refactoring that method into one part that decodes the instruction and
another that sends it to the client.
I can't help feeling that we would be better off without the black
magic of MessageCatcher.
Cheers!
--Tom Phoenix