TranscriptStream questions

Phil Weichert weichert at hal-pc.org
Wed Sep 12 16:02:13 UTC 2001


Ken wrote:
In attempting to understand what's going on, I tried the following:
myTranscript _ TranscriptStream new.
myTranscript openAsMorphLabel: 'My Transcript'.
myTranscript openInWorld. "This gets a message not understood - openInWorld"

Look at the first line in bottom view of the error notifier, It clearly states
who did not understand the message openInWorld.
The line read: "TranscirptStream(Object)>>doesNotUnderstand:"
Therefore the temporary varible,myTranscript, must be an intance of
TranscriptStream.
What I am trying to convey of that an Object is sent a message and the result
(what is returned) is always an object.
In the line "myTranscript _ TranscriptStream new.", The object is the class
TranscriptStream, the message is new.  The result is assigned to myTranscript.
myTranscipt is an instance of TranscriptStream.  It is very important to always
know the context, the active object.  This is not always easy is find out.

Ned Konz was pointing this out in his message.

Method Finder is an excellent tool to find out what object(s) implement a
message.

Also, I highly recommend using the debugger to follow the evaluation sequence as
well as learning which are the messages and which objects are executing the
message.  Highlight the next line and evaluate with doIt.
((myTranscript _ TranscriptStream new) halt; openAsMorphLabel: 'My Transcript')
openInWorld.
myTranscript show: 'my text'.

The brings up the Error Notifier.
Click on Debug.
Select the first line (top view) which reads TranscriptStream(Object)>>halt.
Click on Step button.
"openAsMorphLabel: 'My Transcript'"is hightlighted. (may have to put cursor in
view).  The hightlighting idicates that this is the next message with its
argument to be evaluated.
Click on Send button.
Now you see that you are in the method, openAsMorphLabel:
In the lower left corner, selecting self shows that self is a TranscriptStream.
i.e. openAsMorphLabel: is an instance method of TranscriptStream.  A the botton
of the method you will see the the method returns window.  Remember a message is
sent to an object and the result is always an object.

Happy Oops!
Phil










More information about the Squeak-dev mailing list