Reimplementing the bulk of std.meta iteratively
Timon Gehr
timon.gehr at gmx.ch
Thu Oct 1 12:41:34 UTC 2020
On 01.10.20 10:59, Walter Bright wrote:
> On 10/1/2020 12:51 AM, Timon Gehr wrote:
>> Maybe this is related to what you mean?
>>
>> type t = readln().strip()=="int"?int:double;
>> auto f = (t x)=>x;
>
>
> As D is a statically typed language, I don't see how that can ever work.
The example is easy to type check statically. In terms of ABI, you just
have to make sure that `f` can find the context pointer without already
knowing the value of `t`, then it can reconstruct everything it needs to
know.
More information about the Digitalmars-d
mailing list