From unoduetre at poczta.onet.pl Wed Apr 15 03:47:04 2015 From: unoduetre at poczta.onet.pl (Mateusz Grotek) Date: Wed Apr 15 03:32:19 2015 Subject: [Newbies] storeString equivalent without duplicates Message-ID: <1429069624.29823.0@mglap> 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 From leves at elte.hu Wed Apr 15 04:01:39 2015 From: leves at elte.hu (Levente Uzonyi) Date: Wed Apr 15 04:01:43 2015 Subject: [Newbies] storeString equivalent without duplicates In-Reply-To: <1429069624.29823.0@mglap> References: <1429069624.29823.0@mglap> Message-ID: 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@lists.squeakfoundation.org > http://lists.squeakfoundation.org/mailman/listinfo/beginners