[Cuis-dev] storeString of literal arrays has a space before the closing bracket

Christian Haider mail at christianhaider.de
Sun Mar 3 06:13:27 PST 2024


Hi all,

 

I am getting a bit into Cuis with trying to port some Values stuff.

 

One oddity I found is that literal arrays have an extra space in their
#storeString :

#(1 2 3) storeString -> '#(1 2 3 )'

#($a 42 'abc') storeString -> '#($a 42 'abc' )'

 

In contrast, #printString behaves as expected (without trailing blank):

#(1 2 3) printString -> '#(1 2 3)'

#($a 42 'abc') printString -> '#($a 42 'abc')'

 

Could the implementation be changed to something like:

Array>>storeOn: aStream 

                "Use the literal form if possible."

 

                self isLiteral

                               ifTrue: [

                                               aStream nextPut: $#; nextPut:
$(.

                                               self do: [ :element | element
storeOn: aStream] separatedBy: [aStream space].

                                               aStream nextPut: $)]

                               ifFalse: [super storeOn: aStream]

 

With this change, all tests (1955) from the BaseImageTests package pass, but
I don't know if other code depends on this.

 

This would allow me to drop an ugly work-around in the Values code.

 

Happy hacking,

Christian

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240303/bee65800/attachment.htm>


More information about the Cuis-dev mailing list