<div dir="ltr"><div dir="ltr">On Thu, Apr 23, 2020 at 10:45 PM Simen Kjærås via Digitalmars-d <<a href="mailto:digitalmars-d@puremagic.com">digitalmars-d@puremagic.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Wednesday, 22 April 2020 at 12:04:30 UTC, Manu wrote:<br>
> This DIP single-handedly fixes compile-time issues in programs <br>
> I've written by reducing template instantiations by near-100%, <br>
> in particular, the expensive ones; recursive instantiations, <br>
> usually implementing some form of static map.<br>
><br>
> We should have done this a long time ago.<br>
<br>
This is beautiful and awesome (syntax and all).<br>
<br>
I was wondering if there's any way to to do a cross product with <br>
this, like fun(Xs, Ys)... expand to fun(Xs[0], Ys[0]), fun(Xs[0], <br>
Ys[1]), fun(Xs[1], Ys[0]), fun(Xs[1], Ys[1]), but that might very <br>
well be rare enough to not warrant special consideration.<br></blockquote><div><br></div><div>You can do this by expanding tuples with the appropriate indices:</div><div>  fun(Xs[CrossIndexX], Ys[CrossIndexY])...  <br></div><div>Where 

CrossIndexX

 is (0, 0, 1, 1) and 

CrossIndexY is (0, 1, 0, 1).</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
The other thing that worries me a little is the difference <br>
between Foo!(AliasSeq!(1,2))... and Foo!(Numbers)... - would <br>
Foo!(AliasSeq!(1,2)...)... do the same as Foo!(Numbers)...?<br></blockquote><div><br></div><div>This needs to be clarified in the DIP; the AliasSeq!() instantiation there is NOT actually a tuple (yet). It's just a template instantiation expression.</div><div><br></div><div>So, Foo!(AliasSeq!(1,2)...)... does nothing; there's no tuple in the expression to expand.</div><div>If you want to expand that AliasSeq, you need the second expression you wrote:</div><div>  alias Numbers = 

AliasSeq!(1,2);</div><div>  Foo!(Numbers)...</div><div><br></div><div>So the answer is no, they are not the same.</div></div></div>