Am 06.10.2015 um 12:05 schrieb Alex:
JSON is a particular file format useful for serialising heirachical data.
Given that D also has an XML module which appears to be deprecated, I
wonder if it would be better to write a more abstract
serialisation/persistance module that could use either json,xml,some
binary format and future formats.
I would estimate that more than 70% of the times, the JSON data will
only be read and written by a single D application, with only occasional
inspection by developers etc.
In these cases it is undesirable to have code littered with types coming
from a particular serialisation file format library.
As the software evolves that file format might become
obsolete/slow/unfashionable etc, and it would be much nicer if the
format could be changed without a lot of code being touched.
The other 30% of uses will genuinely need raw JSON control when
reading/writing files written/read by other software, and this needs to
be in Phobos to implement the backends.
It would be better for most people to not write their code in terms of
JSON, but in terms of the more abstract concept of
persistence/serialisation (whatever you want to call it).
A generic serialization framework is definitely needed! Jacob Carlborg
had once tried to get the Orange[1] serialization library into Phobos,
but the amount of requested changes was quite overwhelming and it didn't
work out so far. There is also a serialization framework in vibe.d[2],
but in contrast to Orange it doesn't handle cross references (for
pointers/reference types).
But this is definitely outside of the scope of this particular module
and will require a separate effort. It is intended to be well suited for
that purpose, though.
[1]: https://github.com/jacob-carlborg/orange
[2]: http://vibed.org/api/vibe.data.serialization/