Reimplementing the bulk of std.meta iteratively

Walter Bright newshound2 at digitalmars.com
Thu Oct 1 08:56:58 UTC 2020


On 10/1/2020 12:48 AM, Timon Gehr wrote:
> (In terms of compiler implementation, the runtime representation of `T` would 
> contain all information that is necessary to figure out calling conventions of 
> functions that take a T, it would contain sizeof, pointers to 
> destructor/postblit, etc, so basically it's typeid.)

I had looked into this. Unfortunately, many aspects of types are simply too 
complex to try and represent at run time. For example, is type T1 implicitly 
convertible to T2? This seemingly simple question is very complex. Yes, `alias 
this` makes it much worse :-/

I initially had high hopes for typeid back when it was originally designed 20 
years ago. It ably fulfills its original purpose of enabling the GC and 
associative arrays in a language with no templates.

I don't see much future for it other than being kept around for legacy 
compatibility.


More information about the Digitalmars-d mailing list