<div dir="ltr"><div dir="ltr">On Sat, Oct 31, 2020 at 12:05 PM Paul Backus 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 Friday, 30 October 2020 at 23:55:54 UTC, Manu wrote:<br>
><br>
> I was about to raise both those examples you showed here. I show<br>
> staticMap's implementation right there, and I also show types <br>
> in tuples.<br>
> The trouble as I see is that there's a spec language problem, <br>
> where a tuple<br>
> element is a 'kind of thing' that I don't know what to call <br>
> that.<br>
<br>
I think "tuple element" is probably the best you can do. It's a <br>
little clunky, but clunky is better than ambiguous.<br></blockquote><div><br></div><div>If I drop the term "tuple" for "alias sequence", then that results in "alias sequence element", which really doesn't roll off the tongue!</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
> What do you call this: MyTypeTuple[10] ?<br>
> Is that an index *expression*? Internally, it's an IndexExp, <br>
> but the tuple<br>
> does not have expression elements, so the result is not an <br>
> expression, it's<br>
> a type. I would call that an expression as applied to a tuple <br>
> regardless<br>
> what kind of thing the result is.<br>
> What about this: MyThing.Member <- where Member may be a type. <br>
> Internally<br>
> that's called a DotIdExp... so it's still an expression, even <br>
> if it's<br>
> result is not an expression.<br>
<br>
According to the grammar in the language spec, these are both <br>
IdentifierLists [1] when they appear in a context where a type is <br>
expected. In a context where an expression is expected, <br>
`MyTuple[10]` is an IndexExpression [2], and `MyThing.Member` is <br>
a PostfixExpression [3]. There is no such thing as a DotIdExp in <br>
the language spec.<br>
<br>
In general, if you need to refer to a particular syntactic <br>
construct, I think it's better to use the name from the language <br>
spec, rather than the DMD-internal class name.<br>
<br>
[1] <a href="https://dlang.org/spec/grammar.html#IdentifierList" rel="noreferrer" target="_blank">https://dlang.org/spec/grammar.html#IdentifierList</a><br>
[2] <a href="https://dlang.org/spec/grammar.html#IndexExpression" rel="noreferrer" target="_blank">https://dlang.org/spec/grammar.html#IndexExpression</a><br>
[3] <a href="https://dlang.org/spec/grammar.html#PostfixExpression" rel="noreferrer" target="_blank">https://dlang.org/spec/grammar.html#PostfixExpression</a></blockquote><div><br></div><div>Is "Alias Sequence" present in spec language?</div><div>This really demonstrates how much D needs first-class tuples; this area of the language is a shit-fight, and essentially just a weird abuse of template argument lists mixed with `alias` and some implementation defined behaviour, which happens to look and feel a lot like a tuple.</div></div></div>