October 04, 2020
On Sunday, 4 October 2020 at 05:14:02 UTC, Timon Gehr wrote:
> On 04.10.20 07:04, Basile B. wrote:
>> On Saturday, 3 October 2020 at 21:36:20 UTC, Stefan Koch wrote:
>>> On Saturday, 3 October 2020 at 14:16:09 UTC, Basile B. wrote:
>>>> [...]
>>>
>>> type functions are supposed to support UFCS.
>>> How would I do that with the calling syntax you propose?
>> 
>> UFCS style still works:
>> 
>>    size_t SizeOf(alias T){ return T.sizeof; }
>> 
>>    static assert (SizeOf!!(ubyte) == 1);
>>    static assert (ubyte!!SizeOf() == 1);
>>    static assert (ubyte!!SizeOf == 1);
>> 
>> although you clearly loose the feel that it's like a builtin property.
>
> IMO this is ugly and unnecessary. The distinction between types and expressions in the parser is pointless anyway.

Yes that's what I meant to say.
October 04, 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());
---
1 2
Next ›   Last »