[SMALL BUG]TranscriptStream in MVC?
Henrik.Gedenryd at lucs.lu.se
Fri Sep 15 17:31:48 UTC 2000
Dan Ingalls wrote:
>> transcript := TranscriptStream new.
>> transcript openLabel: 'Test'.
>> transcript show: 'Why does not this text show up?';cr.
>> This opens the new Transcript but no text is shown.
>> transcript show: 'But this does!!!';cr.
> You were only lucky if this worked in morphic. I executed
> Transcript cr; print: 3
> with a transcript open, and saw nothing until I did
> Transcript endEntry.
Yay! I get to correct Dan I. Is that a Squeak scalp or what! ;-) ;-) (I know
Dan doesn't like being portrayed as a Jedi, which makes this small teasing
opportunity impossible to pass up!)
Dan: your example uses print: which merely puts text in the stream, without
forcing it to the screen, whereas Göran's example uses show: which also
forces the screen to update. (--literally--in Morphic it sends a message to
update the whole screen, a rather expensive operation, but perhaps necessary
to ensure consistent behavior in certain debugging situations.) So the
behavior in your example is not a bug. Göran's problem seems unrelated. (And
the only way to make a final #cr or #tab have an effect is by sending
endEntry, or doing another show:)
It is however, a lot less than obvious, and most of the yay was really
because I'm not the only one who've had trouble with it.
Still, because of the performance penalty, having the non-updating behavior
is essential. show: causes the whole screen to redraw even if the Transcript
is collapsed. I thought the Squeak Prolog was really slow until I
painstakingly learned not to cascade show: say five times in a row to print
a debug information string for every clause matched...
Isn't this the same issue as with WriteLn() in Pascal, where not knowing
this can make you look for a bug in the wrong place, thinking that the
print: message hasn't been reached? A classic gotcha indeed. I once had to
help a colleague debug exactly this issue, just to save myself from being
speared by one of the screwdrivers flying from his desk.
Perhaps changing to a stepping updating mechanism would be the way to go in
More information about the Squeak-dev