Discussion Thread: DIP 1037--Add Unary Operator ...--Community Review Round 1
Steven Schveighoffer
schveiguy at gmail.com
Fri Oct 30 23:09:20 UTC 2020
On 10/30/20 2:29 PM, Andrei Alexandrescu wrote:
> On 10/29/20 9:48 AM, Steven Schveighoffer wrote:
>> 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.
>
> What would the implementation of staticMap with the DIP look like? As
> far as I can tell from the DIP it cannot be done.
It has the implementation right in the DIP:
alias staticMap(alias F, T...) = F!T...;
>> Perhaps it's simply vocabulary that is the problem?
>
> May as well. The way the DIP is written, there's no discussion of tuples
> containing anything else but values.
In the examples there are. e.g.:
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
Maybe it's not as clear with terminology. In some places it talks about
tuples and their "elements", and in others, it talks about "values". I
don't think it ever specifically talks about types in the description.
-Steve
More information about the Digitalmars-d
mailing list