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

Steven Schveighoffer schveiguy at gmail.com
Thu Oct 29 13:48:41 UTC 2020


 From the Feedback Thread:

> * Major bug: the "Rationale" discusses only expression, whereas
> staticMap does not use expressions. It just processes tuples, which may
> contain types. Types cannot appear in expressions. C++ goes to great
> lengths to distinguish between template parameter packs (which may be
> one of type parameter pack, value parameter pack, and template template
> parameter pack) and function parameter packs (which may only be
> parameter declarations). By the Rationale nothing except expressions
> will be accessible to D's proposed "...". That means no staticMap for
> non-valies (e.g. staticMap!(Unqual, types)), which probably wasn't the
> intent of the DIP.

I am confused by this. Isn't it fine to work with expressions only?

I mean staticMap's implementation can be replaced with a ... expansion, 
because even though there might be types in the list, there are no types 
in staticMap, just tuples.

And a type can appear in an expression, as a template parameter:

alias everyOther = AliasSeq!(0, 2, 4);

alias everyOtherType = (AliasSeq!(int, uint, char, byte, ubyte, 
int)[everyOther])...;

I think the DIP is intending for staticMap to be wholesale replaced with 
this, and seems to be saying this to me. I don't understand the above 
complaint, and why static map wouldn't work with types.

Perhaps it's simply vocabulary that is the problem?

-Steve


More information about the Digitalmars-d mailing list