<div dir="ltr"><div dir="ltr">On Sat, Oct 31, 2020 at 9:10 AM Steven Schveighoffer via Digitalmars-d <<a href="mailto:digitalmars-d@puremagic.com">digitalmars-d@puremagic.com</a>> wrote:<br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 10/30/20 2:29 PM, Andrei Alexandrescu wrote:<br>
> On 10/29/20 9:48 AM, Steven Schveighoffer wrote:<br>
>> And a type can appear in an expression, as a template parameter:<br>
>><br>
>> alias everyOther = AliasSeq!(0, 2, 4);<br>
>><br>
>> alias everyOtherType = (AliasSeq!(int, uint, char, byte, ubyte, <br>
>> int)[everyOther])...;<br>
>><br>
>> I think the DIP is intending for staticMap to be wholesale replaced <br>
>> with this, and seems to be saying this to me. I don't understand the <br>
>> above complaint, and why static map wouldn't work with types.<br>
> <br>
> What would the implementation of staticMap with the DIP look like? As <br>
> far as I can tell from the DIP it cannot be done.<br>
<br>
It has the implementation right in the DIP:<br>
<br>
alias staticMap(alias F, T...) = F!T...;<br>
<br>
>> Perhaps it's simply vocabulary that is the problem?<br>
> <br>
> May as well. The way the DIP is written, there's no discussion of tuples <br>
> containing anything else but values.<br>
<br>
In the examples there are. e.g.:<br>
<br>
alias Values = AliasSeq!(1, 2, 3);<br>
alias Types = AliasSeq!(int, short, float);<br>
pragma(msg, cast(Types)Values...);<br>
<br>
 > cast(int)1, cast(short)2, cast(float)3<br>
<br>
Maybe it's not as clear with terminology. In some places it talks about <br>
tuples and their "elements", and in others, it talks about "values". I <br>
don't think it ever specifically talks about types in the description.<br>
<br>
-Steve<br></blockquote><div><br></div><div>I was about to raise both those examples you showed here. I show staticMap's implementation right there, and I also show types in tuples.</div><div>The trouble as I see is that there's a spec language problem, where a tuple element is a 'kind of thing' that I don't know what to call that.</div><div>It may be a value, or a type, or an alias, and in most cases, I don't refer to the contents of the tuple, just to the tuple itself. The kind of thing in the elements is largely irrelevant to this dip; it's a later phase in compilation where (as with any tuple in normal circumstances) the elements of the tuple are determined to have some meaning in context.</div><div><br></div><div>I think people are hung up by my use of the word 'expression' to mean "some syntax tree" involving whatever kind of thing that may be in the tuple elements...?</div><div>What do you call this: MyTypeTuple[10]  ?<br></div><div>Is that an index *expression*? Internally, it's an IndexExp, but the tuple does not have expression elements, so the result is not an expression, it's a type. I would call that an expression as applied to a tuple regardless what kind of thing the result is.</div><div>What about this: MyThing.Member  <- where Member may be a type. Internally that's called a DotIdExp... so it's still an expression, even if it's result is not an expression.<br></div><div><br></div><div>Can you show where my use of language in this DIP is inconsistent with these precedents?</div></div></div>