rootbeer at redcat.com
Tue Jan 22 01:44:28 UTC 2008
On Jan 21, 2008 1:59 PM, Keith Hodges <keith_hodges at yahoo.co.uk> 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,
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]].
>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.
More information about the Squeak-dev