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

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Nov 3 13:46:20 UTC 2020


On 11/3/20 2:05 AM, Manu wrote:
>    MyTemplate!(expr...) <-- appearance in template parameter lists

By the way in C++ the expansion applies to so-called patterns, not 
expressions:

pattern...

The pattern allowed depends on the context in which it's seen. E.g., if 
it's in a function call arguments, it's the largest expression to the 
left of "...".

The difficulty in D is that it's not always clear if something is meant 
to be an expression or a type. Consider:

template X(T...) { }
X!(pattern...);

It's unclear whether the pattern is meant to expand into types or 
expressions. I don't know whether there's a case in D where that could 
create a confusion.


More information about the Digitalmars-d mailing list