[squeak-dev] Character space and literal arrays

Nicolas Cellier nicolas.cellier.aka.nice at gmail.com
Wed Sep 22 21:18:14 UTC 2010


something old like http://bugs.squeak.org/view.php?id=4322
http://bugs.squeak.org/view.php?id=5700

Nicolas

2010/9/22 Eliot Miranda <eliot.miranda at gmail.com>:
> Hi Lukas,
>     there's a problem with the current printOn:/storeOn: distinction in
> current Squeak.  The issue is that within a literal Array all characters
> must be printed using the $ form, /not/ the Character message or (Character
> value: N) forms. e.g.
> #($ ) storeString => #(Character space)
> (Compiler evaluate: #($ ) storeString) size => 2
> (Compiler evaluate: #($ ) storeString) = #(#Character #space) => true
> In VisualWorks (7.7) the above works correctly (*)
> #($ ) storeString => #($ )
> (Compiler evaluate: #($ ) storeString) size => 1
> (Compiler evaluate: #($ ) storeString) = #(#Character #space) => false
> and works because Array asserts the "characters print literally" stream
> policy while printing literally.
>
> I stumbled upon this looking at the decompiler tests, specifically of
> MethodPragmaTest>>testCompileCharacter:
> testCompileCharacter
> self assertPragma: 'foo: $a' givesKeyword: #foo: arguments: #( $a ).
> self assertPragma: 'foo: $ ' givesKeyword: #foo: arguments: #( $  ).
> which decompiled shows as
> testCompileCharacter
> self
> assertPragma: 'foo: $a'
> givesKeyword: #foo:
> arguments: #($a ).
> self
> assertPragma: 'foo: $ '
> givesKeyword: #foo:
> arguments: #(Character space )
>
>
> (*) but VW still has a bizarre def for printString,
> (Array with: Character space) printString '#(Core.Character space)'
> (Compiler evaluate: (Array with: Character space) printString) size => 2
>
> best
> Eliot
>
>
>



More information about the Squeak-dev mailing list