Am 26.01.2013 00:21, schrieb punkUser:

I ran into what I think is an issue with serializeToJson the other day, namely it uses "isRWField"
inside the loop over structure members. Presumably this is to avoid stuff that isn't really a member
variable, but it seems to mean that if I pass a constant or immutable structure as the input to
serializeToJson, it simple ignores all of the members (since "compiles(input.m = input.m) = false").

Is this a bug, or am I missing some sort of intended behaviour? I'm not sure I totally understand
why a field being writeable is the criteria for serializing it, but assuming it is, perhaps it
should instead be testing an Unqual!T version of the type or something instead?

The intention for checking readability and writability is that only fields should be serialized that
can be deserialized afterwards. Since the deserializer cannot use the constructor for initializing
const/immutable fields, it basically has no chance to handle such fields.

It's definitely a bug though, that it doesn't serialize a struct that is passed as
const/immutable. Using Unqual inside __traits(allMembers, Unqual!T) should indeed fix it. I'll
check in something later.