Reimplementing the bulk of std.meta iteratively

Stefan Koch uplink.coder at googlemail.com
Thu Oct 8 10:06:41 UTC 2020


On Thursday, 8 October 2020 at 10:05:10 UTC, Atila Neves wrote:
> On Thursday, 8 October 2020 at 09:51:28 UTC, Stefan Koch wrote:
>> On Thursday, 8 October 2020 at 09:44:33 UTC, Atila Neves wrote:
>>> [...]
>>
>> What you just described is what type functions do.
>> The point that with first class type you could do also this:
>>
>> // cat type_list.txt: 'int, uint, long, ulong';
>> auto type_txt = readText("type_list.txt");
>> type[] types = type_txt.parseTypes()
>> auto size4 = types.filter!(a => a.sizeof == 4);
>> assert(equal(size4, [int, uint]));
>> type[0] myVar1;
>> type[1] myVar2;
>
> There's no IO at compile-time.

Exactly!
first class type can be determined at runtime!


More information about the Digitalmars-d mailing list