[OT] Do you see a problem in this serialization format ?

Basile B. via Digitalmars-d digitalmars-d at puremagic.com
Tue Jun 7 04:22:55 PDT 2016


On Tuesday, 7 June 2016 at 10:24:56 UTC, WebFreak001 wrote:
> On Tuesday, 7 June 2016 at 02:11:55 UTC, Basile B. wrote:
>> I had to make a custom format because
>
> Why do you want to make a custom format? There is a SDL library 
> for D (dub uses it) and SDL looks pretty nice if you absolutely 
> don't want to use JSON. This is the SDL page which s`ludwig 
> made with some implementation links: http://sdlang.org/
>
> Still for your example I think JSON would have been fine. JSON 
> is also a widely supported standard, so I would always try to 
> use it.

SDL would have the same problem as JSON. I need to store the 
type, so key = value does not work and an object (that contains 
name = "thename", type = "thetype", value = "value") must be 
created for each property. The serialisation data become huge and 
is painfull to read.

The serializer needs the type to be stored so that it can 
retrieve the RTTI while deserializing (or to create objects from 
a factory, or to retrieve a delegate in a reference storage). 
It's because the serialization system is type safe. A property 
are only restored if the name and the RTTI match.


More information about the Digitalmars-d mailing list