pharo-wiki
pharo-wiki copied to clipboard
Dealing with BlockClosure with JSON or STON encoding
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?
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.
Ok, but that is missing from the documentation.
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.