Re: reflection over templates

2014-03-19 Thread Dicebot
On Wednesday, 19 March 2014 at 16:18:17 UTC, Andrej Mitrovic wrote: And after we determine it is a template, can we extract the required arguments list like we can with a regular function at all? Well there's TemplateArgsOf for *instantiations*, but I'm not sure how one would do it with

Re: reflection over templates

2014-03-19 Thread Dicebot
As a workaround one can use set of relevant trait checks: 1) type is void 2) is not a variable or callable 3) .stringof fits NAME(ARGS) pattern

Re: reflection over templates

2014-03-19 Thread Dicebot
Wait just a bit more https://github.com/D-Programming-Language/dmd/pull/3380 :)

Re: reflection over templates

2014-03-19 Thread Adam D. Ruppe
On Wednesday, 19 March 2014 at 16:10:52 UTC, Dicebot wrote: Wait just a bit more https://github.com/D-Programming-Language/dmd/pull/3380 :) megarox. Make it so.

reflection over templates

2014-03-19 Thread Adam D. Ruppe
Given: template Foo(string T) { enum Foo = to!int(T); } (or anything else, really) Is there anything we can do with static if to identify it as a template? I tried: static if(is(Foo == template)) {} // nope, basic type expected, not template Note that is(typeof(Foo) == function) {} is

Re: reflection over templates

2014-03-19 Thread Andrej Mitrovic
On 3/19/14, Adam D. Ruppe destructiona...@gmail.com wrote: Is there anything we can do with static if to identify it as a template? https://github.com/D-Programming-Language/dmd/pull/3380 And after we determine it is a template, can we extract the required arguments list like we can with a

Re: reflection over templates

2014-03-19 Thread simendsjo
On 03/19/2014 05:34 PM, Adam D. Ruppe wrote: On Wednesday, 19 March 2014 at 16:10:52 UTC, Dicebot wrote: Wait just a bit more https://github.com/D-Programming-Language/dmd/pull/3380 :) megarox. Make it so. Nice. I have some ugly hacks that's probably full of bugs for this (look at the