On Tue, Jul 16, 2013 at 8:29 PM, Timothee Cour <span dir="ltr"><<a href="mailto:thelastmammoth@gmail.com" target="_blank">thelastmammoth@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="HOEnZb"><div class="h5">On Tue, Jul 16, 2013 at 7:52 PM, JS <span dir="ltr"><<a href="mailto:js.mdnq@gmail.com" target="_blank">js.mdnq@gmail.com</a>></span> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

<br>
It seems that one must use two templates to process built in times and strings<br>
<br>
template A(string a) { ... }<br>
template A(a) { enum A = A(typeof(a).stringof); }<br>
<br>
This is so we can do stuff like A!(double) and A!("double").<br>
<br>
The problem is when we have many parameters the number of permutations increases exponentially.<br>
<br>
Is there a better way to unify the two?<br>
</blockquote></div><br></div></div><div><div>template a(T...)if(T.length==1){</div><div>  enum a=1;</div><div>}</div><div>void main(){</div><div>  auto a1=a!double;</div><div>  auto a2=a!"double";</div><div>}</div>
</div><div>
<br></div><div>However:</div><div>This syntax sucks.</div><div>Why not support the following syntax:</div><div><div>template a(auto T) {...}</div></div><div>with same semantics?</div><div><br></div><div>Because this is problematic with more arguments:</div>

<div>I'd like this:</div><div><div>template a(auto T1, double T2){...}</div><div><br></div><div>but instead have to do that:</div></div><div><div>template a(T...)if(is(T[1]==double)) {...}</div></div><div>and it gets quickly more complicated</div>

<div><br></div>
</blockquote></div><div><br></div>A)<br><div>actually, I'm not sure if auto would be the best keyword here, but maybe another keyword. </div><div><br></div><div>B)</div><div>What's the rationale why alias can't match to a primitive type in the first place?</div>
<div><br></div><div>C)</div><div>correction: above, it should be:</div><div>template a(T...)if(T.length==2 && is(T[1]==double)) {...}</div><div>which is quite verbose.</div>