std.jgrandson

Dicebot via Digitalmars-d digitalmars-d at puremagic.com
Sun Aug 3 16:42:09 PDT 2014


On Sunday, 3 August 2014 at 19:36:43 UTC, Sönke Ludwig wrote:
> Do you have a specific case in mind where the data format 
> doesn't fit the process used by vibe.data.serialization? The 
> data format iteration part *is* abstracted away there in 
> basically a kind of traits structure (the "Serializer"). When 
> serializing, the data always gets written in the order defined 
> by the input value, while during deserialization the serializer 
> defines how aggregates are iterated. This seems to fit all of 
> the data formats that I had in mind.

For example we use special binary serialization format for 
structs where serialized content is actually a valid D struct - 
after updating internal array pointers one can simply do 
`cast(S*) buffer.ptr` and work with it normally. Doing this 
efficiently requires breadth-first traversal and keeping track of 
one upper level to update the pointers. This does not fit very 
well with classical depth-first recursive traversal usually 
required by JSON-structure formats.


More information about the Digitalmars-d mailing list