I'm not sure what your goal with this marshaller is but I would
say it's a lot harder than you think if you want to have a
complete serialization library. A couple of things making it
harder to create a fully working serialization library:
I'm basically trying to reproduce other JSON marshallers, like
Go's, but using compile-time reflection. Go uses runtime
reflection, which D notably does not support. I like the idea of
compile-time reflection better anyway. There are a few things
that would make it easier (like a __traits call like allMembers
that excludes functions).
I use a lot of JSON, so a JSON marshaller/unmarshaller is going
to save a lot of time, and make my code a lot cleaner.
* Pointers
I've done this, but haven't fully tested it. Basic pointers work.
* Array slices
I think this is handled.
* Serializing through base class references
Doesn't __traits(allMembers, T) give everything from all super
classes?
* const/immutable fields
Hmm, not sure to handle this. These have to be set in the
constructor, right?
* Any reference type (not really hard but it's more work)
Are you talking about aliases? What other kind of reference types
are there in structs/classes? I'm assuming this will have more to
do with marshalling as opposed to unmarshalling.
Have a look at for a basically fully working serialization
library Orange:
https://github.com/jacob-carlborg/orange
Hmm, looks interesting. This looks like it only supports XML,
which I don't use, but I'm sure you've already solved a lot of
the corner cases. Thanks, I'll take a look!