You can't serialise blocks with STON. The design goal of STON was to be able to serialise regular domain models.
Classes are written as a global reference to their name, as a kind of shortcut (as opposed to writing out the whole class structure). For blocks there is no easy solution, AFAIK. > On 2 Nov 2016, at 20:03, Dimitris Chloupis <kilon.al...@gmail.com> wrote: > > I tried to use my ChronosManager object with it and STON does not seem to > like this > > m := ChronosManager new. > s:= STON toString: m > s inspect. > > STONWriter>>error: > BlockClosure(Object)>>stonOn: > STONWriter>>nextPut: > STONWriter>>encodeKey:value: > STONMapWriter>>at:put: > [ :each | > (anObject instVarNamed: each) > ifNotNil: [ :value | dictionary at: each asSymbol put: value ] > ifNil: [ anObject stonShouldWriteNilInstVars > ifTrue: [ dictionary at: each asSymbol put: nil ] ] ] > in [ :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 ] ] ] ] in STONWriter>>writeObject: in Block: [ :each | ... > Array(SequenceableCollection)>>do: > [ :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 ] ] ] ] in STONWriter>>writeObject: in Block: [ :dictionary | ... > [ self newlineIndent. > block value: mapWriter ] in [ | mapWriter | > mapWriter := STONMapWriter on: self. > writeStream nextPut: ${. > self > indentedDo: [ self newlineIndent. > block value: mapWriter ]. > self newlineIndent. > writeStream nextPut: $} ] in STONWriter>>writeObject:streamMap: in Block: [ > self newlineIndent.... > STONWriter>>indentedDo: > [ | mapWriter | > mapWriter := STONMapWriter on: self. > writeStream nextPut: ${. > self > indentedDo: [ self newlineIndent. > block value: mapWriter ]. > self newlineIndent. > writeStream nextPut: $} ] in STONWriter>>writeObject:streamMap: in Block: [ | > mapWriter |... > [ writeStream nextPutAll: anObject class stonName. > self prettyPrintSpace. > block value ] in STONWriter>>writeObject:do: in Block: [ writeStream > nextPutAll: anObject class stonName....etc... > STONWriter>>with:do: > STONWriter>>writeObject:do: > STONWriter>>writeObject:streamMap: > STONWriter>>writeObject: > KMKeymap(Object)>>stonOn: > STONWriter>>nextPut: > STONWriter>>encodeKey:value: > [ :key :value | > first > ifTrue: [ first := false ] > ifFalse: [ self mapElementSeparator ]. > self encodeKey: key value: value ] in [ self newlineIndent. > pairs > keysAndValuesDo: [ :key :value | > first > ifTrue: [ first := false ] > ifFalse: [ self mapElementSeparator ]. > self encodeKey: key value: value ] ] in STONWriter>>encodeMap: > in Block: [ :key :value | ... > [ :assoc | aBlock value: assoc key value: assoc value ] in > Dictionary>>keysAndValuesDo: in Block: [ :assoc | aBlock value: assoc key > value: assoc va...etc... > [ :each | each ifNotNil: [ aBlock value: each ] ] in > Dictionary>>associationsDo: in Block: [ :each | each ifNotNil: [ aBlock > value: each ] ] > Array(SequenceableCollection)>>do: > Dictionary>>associationsDo: > Dictionary>>keysAndValuesDo: > [ self newlineIndent. > pairs > keysAndValuesDo: [ :key :value | > first > ifTrue: [ first := false ] > ifFalse: [ self mapElementSeparator ]. > self encodeKey: key value: value ] ] in STONWriter>>encodeMap: > in Block: [ self newlineIndent.... > STONWriter>>indentedDo: > STONWriter>>encodeMap: > [ self encodeMap: hashedCollection ] in STONWriter>>writeMap: in Block: [ > self encodeMap: hashedCollection ] > STONWriter>>with:do: >