|
Boost : |
From: Robert Ramey (ramey_at_[hidden])
Date: 2021-02-25 18:26:12
On 2/24/21 7:16 PM, Peter Dimov via Boost wrote:
> There's also a scenario where the format is predetermined, and you create your C++ structs to conform to it, rather than vice versa. (This of course assumes that you have an archive supporting the format.)
I've considered this from time to time. Basically this is the approach
that google uses.
boost serialization
C++ data structures => serialization lay out
features of this system
no format specification required
no extra code mapping the the C++ data structures to the externally
defined format
very easy maintenance.
archives not easily read/written by other languages
google protocol buffers
format specified externally. This can be significant work and maintenance.
code required to map to format.
archives designed to be read/written by other languages
Both offer pretty good performance to the point that I suspect that few
will find either a performance bottle neck.
Soooo - how about writing an archive format that either uses or
generates an external specification and perhaps even code to make the
achives read/write able by other languages (javascript anyone). It
would be quite a pain and no one has asked for it. So I'm content to
just suggest that those who need an external format just use google
protocol buffers which is quite popular in any case.
Lately, I've been interested in upgrading the boost serialization
documentation to be more like the safe numerics one. It's already pretty
good, but would benefit by a little more formality, lots more case
studies and examples. It's amazing to me that the serialization library
has lasted 17 years. I have no idea how many people (if any still use
it). The codebase is more healthy than ever having incorporated a huge
number of small improvements over the years. It doesn't take much of my
time to keep it up to date. Most of that time is due to weird
extensions to C++ which add confusion and break previously undefined
stuff.
Here is some information comparing serialization with google protocol
buffers.
https://stackoverflow.com/questions/1061169/boost-serialization-vs-google-protocol-buffers
To the main point, I can see Describe working with serialization in a
reasonable manner. I not yet convinced that the benefit will be worth
the cost. But since it's entirely optional and doesn't require the
serialization code to be altered, I don't see any problem with it.
Robert Ramey
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk