> On 4 Nov 2022, at 17:56, stephane ducasse <stephane.duca...@inria.fr> wrote:
>
> Hi Sven
>
> I was using STON in P7 and I’m now migrating to P10.
> In the past I had no problem with a SortedCollection and now I have because
> of the block serialisation (of course).
> So I cannot really ignore or skip my sorted collection because it has what I
> want.
> I could go over all my collections and transform them into OrderedCollection
> for the saving.
> But may be there is a hook for that.
>
> In fact I do not care to save the sortedCollection as soon as when I reload I
> restore it.
>
>
> S
I read
writeObject: anObject
| instanceVariableNames |
(instanceVariableNames := anObject class stonAllInstVarNames) isEmpty
ifTrue: [
self writeObject: anObject do: [ self encodeMap: #() ] ]
ifFalse: [
self writeObject: anObject streamMap: [ :dictionary |
instanceVariableNames do: [ :each |
(anObject instVarNamed: each)
ifNotNil: [ :value |
dictionary at: each
asSymbol put: value ]
ifNil: [
anObject
stonShouldWriteNilInstVars
ifTrue: [
dictionary at: each asSymbol put: nil ] ] ] ] ]
It would be nice if we could say
MyClass >> transformedInstances
{
#series -> [:each | each asOrderedCollection ] .
}
Or something like that. I was considering to hack my own version of STON to
avoid to that in my model.
Or serializing nicely SortedCollection.
May be I missed something obvious.
S