[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Question] SystemWindow testing



On Wed, 31 May 2000 15:24:38 +0200 Karl Ramberg <karl.ramberg@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