I dun a DIP, possibly the best DIP ever

Steven Schveighoffer schveiguy at gmail.com
Thu Apr 23 18:57:04 UTC 2020


On 4/23/20 2:18 PM, Stefan Koch wrote:
> On Thursday, 23 April 2020 at 18:05:07 UTC, Steven Schveighoffer wrote:
>> On 4/23/20 1:44 PM, Mafi wrote:
>>> [...]
>>
>> What you are asking for is that B is expanded into "not-a-tuple" 
>> before the outer expression is expanded. I don't think that's the 
>> plan, I think SomeTuple... expands to SomeTuple.
>>
>> What I think the DIP is going to do is expand B first into a tuple, 
>> and then that tuple is now expanded the same as F!(A, B)....
>>
>> But maybe I'm wrong? For sure more clarification is needed on nested 
>> expansion.
>>
> 
> If you post a complete example I can run it, at show you what happens.
> I would say inner tuples expand first since that's how evaluating an 
> expression tree works
> you start with the innermost expressions.

The question is whether the expanded inner expression is considered a 
tuple for expansion later or not.

alias tuple1 = AliasSeq!(1, 2, 3);
alias tuple2 = AliasSeq!(4, 5, 6);
pragma(msg, [AliasSeq!(tuple1..., tuple2)...]);

If it expands tuple1 first, then expands tuple 2 without re-expanding 
the result of tuple1..., then it should be:

[1, 2, 3, 4, 1, 2, 3, 5, 1, 2, 3, 6]

If it expands both tuple1 and tuple2 together, it should be:

[1, 4, 2, 5, 3, 6]

-Steve


More information about the Digitalmars-d mailing list