[Newbies] storeString equivalent without duplicates

Levente Uzonyi leves at elte.hu
Wed Apr 15 04:01:39 UTC 2015


Why don't you use one of the existing object serialization methods for 
this? E.g. Fuel, ReferenceStream or ImageSegments.

Levente

On Wed, 15 Apr 2015, Mateusz Grotek wrote:

> Hi,
> Is there any ready-made solution for the following problem.
> I'd like to generate the source code which when evaluated returns an object 
> in a similar way to what storeString does.
> The difference is, that currently storeString creates duplicates.
> For example, let's say I have created an array in the following way:
>
> element := Object new.
> array := {element. element}.
>
> Now if I print:
>
> array storeString
>
> it shows:
>
> '((Array new: 2) at: 1 put: (Object basicNew yourself); at: 2 put: (Object 
> basicNew yourself); yourself)'
>
> so there is the following inconsistency:
>
> array2 := Compiler evaluate: array storeString.
> array first == array second. "true"
> array2 first == array2 second. "false"
>
> If there is no ready-made solution, I'll have to hack one myself.
>
> Best wishes,
> Mateusz
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners


More information about the Beginners mailing list