<div dir="ltr"><div dir="ltr">On Tue, Nov 3, 2020 at 1:15 PM Q. Schroll 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 Tuesday, 3 November 2020 at 02:30:58 UTC, Manu wrote:<br>
> Perhaps my implementation implies additional grammar changes <br>
> that I didn't notice.<br>
<br>
It does, if it should work on types. In the easiest case, if you <br>
want<br>
<br>
     alias X(Args...) = (T!Args)...;<br>
<br>
to work like<br>
<br>
     alias X(Args...) = staticMap!(T, Args);<br>
<br>
you cannot do that by merely adding a new PostfixExpression. It <br>
is necessary to add `...` to BasicType2X, i.e.<br>
<br>
     BasicType2X:<br>
         *<br>
         [ ]<br>
         [ AssignExpression ]<br>
         [ AssignExpression .. AssignExpression ]<br>
+       ...<br>
         [ Type ]<br>
<br>
but I may have overlooked something and it might not suffice. The <br>
grammar concerning "type expressions" is convoluted and has some <br>
stuff going on in AltDeclarator where I'm not entirely sure it <br>
can be ignored.<br></blockquote><div><br></div><div>You're right, and a change like that does exist in my implementation somewhere; I just need to look again at the implementation to spot it and confirm it in the grammar changes.</div><div>I wondered if I overlooked some cases too; but the unit tests are fairly comprehensive and exercise all the constructs that we ever imagined could be useful.</div><div><br></div><div>There's a grammar change that supports:</div><div>   alias staticMap(F, Args...) = F!Args...;</div><div>And also:</div><div>  MyTemplate!(expr...) <-- appearance in template parameter lists</div><div><br></div><div>It's also deliberate and necessary that the grammar is NOT modified such that `...` could be accepted in argument list definitions, because that's where ambiguity can occur.</div><div>If you want to use `...` in an argument list, you can make an alias on the preceding line:</div><div>  alias MappedArgs = TupExpr...;<br></div><div>  void fun(MappedArgs args) { ... }  <-- `...` can not appear in a parameter list, so hoist it to the line above</div><div><br></div><div>I actually really like this incidental restriction; it makes declarations clearer.</div></div></div>