Showing TypeFunction style

Stefan Koch uplink.coder at googlemail.com
Sun Oct 4 23:32:20 UTC 2020


On Saturday, 3 October 2020 at 07:36:17 UTC, Jacob Carlborg wrote:
> On 2020-10-03 00:24, Stefan Koch wrote:
>
>> // temporarly needed because parser issues ....
>> auto makeAliasArray(alias[] types ...)
>> {
>>      return types;
>> }
>
> Not sure if other cares, but your examples will look more 
> appealing if you fix the parser.

Done now:

---

alias alias_t = alias; // this is needed because if a declaration 
starts with alias
it is thought to be the old style of alias declaration.
//Which is ambiguous ... sigh.

alias_t[] makeAliasArray(alias[] array ...)
{
     return array;
}

pragma(msg, makeAliasArray(int, ulong, void)); // outputs [(int), 
(ulong), (void)]

---

For anyone interested the parser change was actually much more 
trivial than I would have thought.


---
           }
+            // if the type is not followed by a dot then the 
type is a type expression
+            if (token.value != TOK.dot)
+            {
+                e = new AST.TypeExp(loc, t);
+                break;
+            }
             check(TOK.dot, t.toChars());
---


More information about the Digitalmars-d mailing list