While investigating squeak Smalltalk I discovered SRP, a serialization library.
What I really like about SRP:
- Compact encoding – Unlike XML markup there are no redundant closing tags and meta information (like the tag name) only has to be recorded once
- Preservation of the object graph – It can deal with cycles in the object graph and will make sure an object is only written to the output stream once
- Tolerance of schema/class changes – In languages with powerful reflection mechanisms (like Smalltalk) it’s possible to reconstruct the stored object even when the original class structure has changed or been removed. Since field access in Smalltalk is just a message send, the library can build an object that responds to these messages even if it is not an instance of the original class used when storing the object.
As an exercise I did a quick port of SRP to the slate environment.