I dun a DIP, possibly the best DIP ever

Steven Schveighoffer schveiguy at gmail.com
Wed Apr 22 16:09:25 UTC 2020


On 4/22/20 11:17 AM, Manu wrote:
> 
> I have thought about how to discuss this in the DIP; I describe the 
> semantic, and what happens is what happens.
> This will work, and something will happen... when we implement 
> TemplateInstance, we'll find out exactly what it is :P
> What I will do is show what such a nested tuple does when code works in 
> the DIP to instantiate TemplateInstances.
> 
> It's basically the same thing as what you showed above with: 
> Items[0].MemberTup, Items[1].MemberTup, ...
> In general, in D currently, nested tuples flatten. Evaluate from the 
> leaf upwards. Your answer will materialise.

I think this is more complicated than the MemberTup thing. By inference 
of the name, MemberTup is a tuple, but only defined in the context of 
the expanded items. There aren't any tuples for the compiler to expand 
in there.

A template that returns a tuple based on it's parameters is a tuple with 
or without expansion.

F!(F!t)) is valid. It's going to return int, char, int, char, int, char, 
int, char

F!(F!t))... what does this do?

Saying "let's see what happens" is not a good way to create a DIP. We 
have enough of "design by implementation" in D.

-Steve


More information about the Digitalmars-d mailing list