I dun a DIP, possibly the best DIP ever

Steven Schveighoffer schveiguy at gmail.com
Thu Apr 23 13:48:54 UTC 2020


On 4/23/20 8:43 AM, Simen Kjærås wrote:
> On Wednesday, 22 April 2020 at 12:04:30 UTC, Manu wrote:
>> This DIP single-handedly fixes compile-time issues in programs I've 
>> written by reducing template instantiations by near-100%, in 
>> particular, the expensive ones; recursive instantiations, usually 
>> implementing some form of static map.
>>
>> We should have done this a long time ago.
> 
> This is beautiful and awesome (syntax and all).
> 
> I was wondering if there's any way to to do a cross product with this, 
> like fun(Xs, Ys)... expand to fun(Xs[0], Ys[0]), fun(Xs[0], Ys[1]), 
> fun(Xs[1], Ys[0]), fun(Xs[1], Ys[1]), but that might very well be rare 
> enough to not warrant special consideration.

You need to do part of it with templates I think. But it should be more 
pleasant. I was writing something, but I haven't finished it. Will see 
if I can come up with it.

These kinds of puzzles are fun ;)

> The other thing that worries me a little is the difference between 
> Foo!(AliasSeq!(1,2))... and Foo!(Numbers)... - would 
> Foo!(AliasSeq!(1,2)...)... do the same as Foo!(Numbers)...?

No, Foo!(AliasSeq!(1, 2)...)... is equivalent to Foo!(AliasSeq!(1, 2))

Whereas if Numbers is a tuple, Foo!(Numbers)... is equivalent to 
Foo!(Numbers[0]), Foo!(Numbers[1]), ...

-Steve


More information about the Digitalmars-d mailing list