Discussion Thread: DIP 1037--Add Unary Operator ...--Community Review Round 1

Steven Schveighoffer schveiguy at gmail.com
Mon Nov 2 12:00:17 UTC 2020

After reading much of the discussion here, a lot of it is about the 
terminology I think and not substance.

It's clear to me that the way the DIP works is:


expands all tuples within "something" according to the DIP rules.

So what is something? Depends on where it is used. My understanding is 
that the *result* is a tuple/AliasSeq, but the *input* could be anything 
that *contains* a tuple. It could be a list of types, it could be a 
template instantiation, it could be an alias, it could be an argument 
list. I think the only place it can't be used is as a parameter list (as 
... is already defined there).

The concept itself is great, and powerful (I played with the 
implementation a while back).

What I think this DIP is missing is a good name for the "something".

I still also would like to know when I need to enclose the something in 

In the DIP for example:

alias Values = AliasSeq!(1, 2, 3);
alias Types = AliasSeq!(int, short, float);
pragma(msg, cast(Types)Values...);

 > cast(int)1, cast(short)2, cast(float)3

How far back does the ... apply? For example, a postfix ++ operator does 
not go back as far as this suggests:

cast(int)foo++; => cast(int)(foo++);

So it seems logical that the above evaluates like:


But your example suggests otherwise.

This is why I asked about operator precedence.

One further issue that still hasn't been addressed (maybe you are 
planning on addressing it, but just haven't commented on my feedback), 
what about nesting?

(something... + 5)...

What happens here?


More information about the Digitalmars-d mailing list