[Cuis-dev] storeString of literal arrays has a space before the closing bracket
Juan Vuletich
juan at cuis.st
Mon Mar 4 10:39:32 PST 2024
Hi Christian,
On 3/3/2024 11:13 AM, Christian Haider via Cuis-dev wrote:
>
> 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
>
While I think that it would be better not to depend on such details, I
agree that your version is better and nicer.
Just pushed it as an update.
Thanks,
--
Juan Vuletich
cuis.st
github.com/jvuletich
researchgate.net/profile/Juan-Vuletich
independent.academia.edu/JuanVuletich
patents.justia.com/inventor/juan-manuel-vuletich
linkedin.com/in/juan-vuletich-75611b3
twitter.com/JuanVuletich
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20240304/970c1e1c/attachment.htm>
More information about the Cuis-dev
mailing list