JSON (was: emscripten )

Adam D. Ruppe destructionator at gmail.com
Wed Dec 15 12:15:22 PST 2010


Robert Jacques wrote:
> I also used allMembers in my first iteration, but it gives what
> I'd consider false positives, so you have to filter the results.

Aye. What I did that was good enough for me was to skip any
names that started with a _ (which hits _ctor and also a naming
convention for "private" variables) and also added a check
for a member function toJsonValue.

If that member function is available, it is called instead of
proceeding inside, letting the struct or class specialize its
own output, thus getting around the naming problems.

I never used it in practice though, since I just learned to
avoid names that cause problems. Not a perfect solution but
it worked for me.


More information about the Digitalmars-d mailing list