Showing TypeFunction style
Basile B.
b2.temp at gmx.com
Sun Oct 4 05:04:03 UTC 2020
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:
>> On Saturday, 3 October 2020 at 12:28:47 UTC, Basile B. wrote:
>>>
>>> calls to type functions have to accept basic types, i.e
>>> keywords.
>>> Even if you've made the biggest part of semantic, you still
>>> need to specify this.
>>
>> not to have a special syntax will make the compiler slower.
>> The expression semantic for a call is already complex, it's
>> better to have a dedicated call with a dedicated syntax for
>> type functions.
>
> 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.
More information about the Digitalmars-d
mailing list