[GemStone-Smalltalk] #printString [was Re: first: / last:]

Richard Sargent via GemStone-Smalltalk gemstone-smalltalk at lists.gemtalksystems.com
Fri Sep 19 08:32:56 PDT 2014


Gemstone/S mailing list wrote
> I can understand the need to keep backward compatibility with base
> methods, but what about printString on Array?
> Any chance it could be made to work like the VW & Pharo?
> 
> GS: #(a b c) printString -->  anArray( #'a', #'b', #'c')  ...    #(1 2 3)
> printString --> anArray( 1, 2, 3)
> VW & Pharo: #(a b c) printString --> #(#a #b #c)  ...   #(1 2 3)
> printString -->  #(1 2 3)
> 
> 
> With VW & Pharo you can evaluate the result and get an Array again.  Handy
> when building scripts.  
> 
> I use our own version of #displayString to get the string we need. 
> 
> I'd use storeString, but in my case I'm going across dialects (GS <> VW),
> and on GS it's a bit verbose...
> #(1 2 3) storeString   --> (PassiveObject newWithContents: '^610^Array(3
> ""1 2 3 ') activate
> 
> FWIW: VA is not good either... #(a b c)  --> (#a #b #c)  ...  #(1 2 3) --> 
> (1 2 3)

Actually, I would argue against this. You want a #printAsLiteral or
something like that, implemented in all your dialects. In such a case, you
take responsibility for ensuring the array can be represented literally.





--
View this message in context: http://forum.world.st/first-last-tp4778749p4779008.html
Sent from the Gemstone/S mailing list archive at Nabble.com.


More information about the GemStone-Smalltalk mailing list