Re: compile time introspection and code generation - automatically serialize to json

2011-07-21 Thread Robert Clipsham
On 21/07/2011 08:57, Tobias Pankrath wrote: Hi everyone, I'm taking a look at D again and asked myself, if it is possible to write a template mixin or something similiar that automatically serializes an object to json. For example: class MyClass { string memberA; int memberB;

Re: compile time introspection and code generation - automatically serialize to json

2011-07-21 Thread Robert Clipsham
On 21/07/2011 08:57, Tobias Pankrath wrote: Hi everyone, I'm taking a look at D again and asked myself, if it is possible to write a template mixin or something similiar that automatically serializes an object to json. For example: class MyClass { string memberA; int memberB;

Re: compile time introspection and code generation - automatically serialize to json

2011-07-21 Thread Jacob Carlborg
On 2011-07-21 09:57, Tobias Pankrath wrote: Hi everyone, I'm taking a look at D again and asked myself, if it is possible to write a template mixin or something similiar that automatically serializes an object to json. For example: class MyClass { string memberA; int memberB;

Re: compile time introspection and code generation - automatically serialize to json

2011-07-21 Thread Tobias Pankrath
Have a look at Orange: http://www.dsource.org/projects/orange I'm in a middle of a complete rewrite but you can use a previous version (if it still works) or look at the code. Thank you for pointing me there. Looks very interesting. I took a quick look at the code and got some questions. I

Re: compile time introspection and code generation - automatically serialize to json

2011-07-21 Thread Adam Ruppe
For another implementation, find the functions toJson and toJsonValue in my web.d http://arsdnet.net/dcode/web.d Bascially: foreach(member; item.tupleof) { static if(is(typeof(member) == something) json it else static if repeat for supported type families }

Re: compile time introspection and code generation - automatically serialize to json

2011-07-21 Thread Jacob Carlborg
On 2011-07-21 13:09, Tobias Pankrath wrote: Have a look at Orange: http://www.dsource.org/projects/orange I'm in a middle of a complete rewrite but you can use a previous version (if it still works) or look at the code. Thank you for pointing me there. Looks very interesting. I took a quick