pharo-wiki icon indicating copy to clipboard operation
pharo-wiki copied to clipboard

Dealing with BlockClosure with JSON or STON encoding

Open vitormcruz opened this issue 5 years ago • 3 comments
trafficstars

STON cannot convert block closure, so what must I do to deal with a object that have N instance variables where one of them is a block closure instance? How to make STON encode those kind of objects?

vitormcruz avatar Mar 20 '20 00:03 vitormcruz

Ston import/export can be customized for an object by implementing #fromSton: and #stonOn: methods on an object. Then you can print your object the way you want. You then need a may serialize your block but that will depend on the context of your object to know how to resolve this issue.

jecisc avatar Mar 25 '20 16:03 jecisc

Ok, but that is missing from the documentation.

vitormcruz avatar Mar 25 '20 16:03 vitormcruz

I mean, the title of the bug is misleading, the problem I wanted to show is that the wiki page that describe JSON and STON does not describe how to customize encoding/serialization. Well, I may close this one and and open another one that states it more clearly if you want.

vitormcruz avatar Mar 25 '20 17:03 vitormcruz