compile time introspection and code generation - automatically serialize to json

Jacob Carlborg doob at me.com
Thu Jul 21 09:26:22 PDT 2011


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 look
> at the code and got some questions. I found this pattern quite often in
> phobos sources, too.
>
> Why do you declare in Reflection.d[1] a template
> parameterNamesOf(alias func) and one called parameterNamesOfImpl? Wouldn't
> be one sufficient?
>
> I do understand the case if you want to use the template recursively and
> hide one parameter like in fieldsOf / fieldsOfImpl.
> Though I don't understand why you are using a recursive template in fieldsOf
> and a imperative function in parameterNamesOfImpl? Is it possible to you use
> both in both places?
>
>
>
> [1] http://www.dsource.org/projects/orange/browser/orange/util/Reflection.d

The thought behind that was that I wanted to force the function to be 
used at compile time. But now when I think about it you could just 
declare the argument as a template argument on the regular function.

-- 
/Jacob Carlborg


More information about the Digitalmars-d-learn mailing list