On Tue, Jul 16, 2013 at 8:29 PM, Timothee Cour <thelastmammoth@gmail.com> wrote:
On Tue, Jul 16, 2013 at 7:52 PM, JS <js.mdnq@gmail.com> wrote:

It seems that one must use two templates to process built in times and strings

template A(string a) { ... }
template A(a) { enum A = A(typeof(a).stringof); }

This is so we can do stuff like A!(double) and A!("double").

The problem is when we have many parameters the number of permutations increases exponentially.

Is there a better way to unify the two?

template a(T...)if(T.length==1){
  enum a=1;
}
void main(){
  auto a1=a!double;
  auto a2=a!"double";
}

However:
This syntax sucks.
Why not support the following syntax:
template a(auto T) {...}
with same semantics?

Because this is problematic with more arguments:
I'd like this:
template a(auto T1, double T2){...}

but instead have to do that:
template a(T...)if(is(T[1]==double)) {...}
and it gets quickly more complicated


A)
actually, I'm not sure if auto would be the best keyword here, but maybe another keyword. 

B)
What's the rationale why alias can't match to a primitive type in the first place?

C)
correction: above, it should be:
template a(T...)if(T.length==2 && is(T[1]==double)) {...}
which is quite verbose.