I made a L-system parser and had it read characters one by one from a text (TextMorph) using the getFirstCharacter tile, and assigning them to a variable: myMorph's text: text getFirstCharacter. This works fine but when I use the variable in a test it will fail because it has actually gotten a character and not a string. myMorph's text = 'G' -> false myMorph's text = $G -> true.
I would think this is a bug in TextMorph>>getFirstCharacter which should read:
TextMorph>>getFirstCharacter "obtain the first character from the receiver if it is empty, return a black dot" | aString | ^ (aString _ text string) isEmpty ifTrue: [''] ifFalse: [aString first asString] ^^^^^^^^
Karl
Yes, this is clearly a bug, and Karl's fix is correct.
Cheers,
-- Scott
At 10:16 PM +0200 9/21/03, Karl Ramberg wrote:
I made a L-system parser and had it read characters one by one from a text (TextMorph) using the getFirstCharacter tile, and assigning them to a variable: myMorph's text: text getFirstCharacter. This works fine but when I use the variable in a test it will fail because it has actually gotten a character and not a string. myMorph's text = 'G' -> false myMorph's text = $G -> true.
I would think this is a bug in TextMorph>>getFirstCharacter which should read:
TextMorph>>getFirstCharacter "obtain the first character from the receiver if it is empty, return a black dot" | aString | ^ (aString _ text string) isEmpty ifTrue: [''] ifFalse: [aString first asString] ^^^^^^^^
Karl
squeakland@lists.squeakfoundation.org