static code generation

js.mdnq js_adddot+mdng at gmail.com
Sun Dec 16 00:33:42 PST 2012


On Sunday, 16 December 2012 at 01:32:44 UTC, r_m_r wrote:
> On 12/16/2012 06:36 AM, r_m_r wrote:
>> this is the closest I can get: http://dpaste.dzfl.pl/9d11d060
>
> Cleaned up a bit: http://dpaste.dzfl.pl/d9f001db
>
> regards,
> r_m_r

That looks like it might be pretty close. I was also thinking 
that one could just use mixin templates of trying to do it with 
structs directly.

I think it is the right approach but the code as is will not work 
with additional type parameters from MasterStruct and UserStruct. 
I ran into the same issues in my nested struct code:

http://dpaste.dzfl.pl/64025e0a

Where I had to pass the types as strings and then append the 
hidden parameter.

Possibly you could try to figure out how to solve this problem? 
Maybe there is a better way then doing it with strings. (it would 
be real nice if I there was a compile time construct for this. 
like "me" or something that would return type info inside the 
current scope.

class A(T) { this() { writeln(me.typeinfo.name); }

would print "A(T)".

(of course me is probably a bad name but just an example :)

I'll be using your code soon once it works with multiple template 
parameters. (I'll make the changes if you don't)

Thanks.











More information about the Digitalmars-d-learn mailing list