[Question] SystemWindow testing

Bob Arning arning at charm.net
Wed May 31 14:52:04 UTC 2000


On Wed, 31 May 2000 15:24:38 +0200 Karl Ramberg <karl.ramberg at chello.se> wrote:
>    I'm testing the following code in a method:
>
>   test _ self world submorphs first.
>   test = SystemWindow
>             ifTrue:[test passivate]
>
>but it never triggers. When I inspect test it say's it's a SystemWindow('Transcript') etc.
>What else is test than a SystemWindow ?

Karl,

The code you wrote is asking if test (some kind of morph) is equal to SystemWindow (a CLASS). Obviously they are not. If this is just hacking around code, then you can do

	test isKindOf: SystemWindow
	test isMemberOf: SystemWindow
	test class == SystemWindow

If, however, this is real code, forget what I just said and try to use a message that SystemWindow implements one way and other morphs implement another. Asking objects about their class reduces the flexibility we have to substitute arbitrary objects as long as they support a particular protocol. This makes your code less useful in the long run.

Cheers,
Bob





More information about the Squeak-dev mailing list