Still trying to kill that pesky morph......

Andreas Raab Andreas.Raab at gmx.de
Mon Oct 22 06:57:35 UTC 2001


John,

> Well, I can only speak as regards what happens (I'm not up to speed on
> theory and am always ready to be corrected!):

If you look at the code then you see that #initializeLocally creates the WTM
(in the variable morph) but does not return it. So if you add as the very
last line

	^morph

then you will be able to get your hands on the morph that was created (and
later on say 'delete' to it). [BTW, since the method has no explicit return,
an implicit 'return self' will be added at the end - but 'self' in this case
is WorldTimeMorph's CLASS and not the morph that was created]

One more side note: The method 'initialize' on the class side is intended to
perform specific class initialization - what's in there right now
(attempting to connect to a remote location and opening a new WTM) should
certainly _not_ go there. Just consider somebody who is not online - that
person will get errors when trying to file in the class. I'd recommend
renaming these two methods into 'open' and 'openLocally' respectively.

> Turning Ned's code into a method "kill" deletes it.

Yes, surely. But it's like taking a nuke to get rid of a single ant. Delete
this kill method - it is extremely bad style, a last-resort solution for
cases that you don't even want to think about.

[BTW, I find it generally a bad idea to teach people these 'last resort'
solutions in a context where they are clearly not needed. This leads people
to think that this is the way to do it when you really should learn
something entirely different (like to look for a return statement or insert
one)]

Cheers,
  - Andreas





More information about the Squeak-dev mailing list