What type functions mean on a language level

Stefan Koch uplink.coder at googlemail.com
Sat Jan 2 22:47:29 UTC 2021


On Saturday, 2 January 2021 at 22:26:32 UTC, sighoya wrote:
> On Saturday, 2 January 2021 at 19:06:32 UTC, Stefan Koch wrote:
>
>>That's needlessly increasing surface knowledge one needs to 
>>have.
>
> Therefore, I recommended mapping `sizeof` to `tsize` and 
> `alignof` to `talign`.
>
> If this isn't possible, then yes you got the point.
>
It isn't possible.

>> The reason that the existing structure typeinfo is not used 
>> much at all is because it's less appealing than using the 
>> template approach, even if that has other issues.
>
> Because you can't even do that yet,
> 1.) we need to lift typeid() to be callable at compile time
> 2.) and to provide a way to convert a typeinfo back as a second 
> class type, i.e. a normal type we use in templates.

You can use typeid at compiletime.
I know because I implemented it.

But TypeInfo is way too incomplete, you don't just need alignment 
or size, you also need members, UDAs, vtbl layouts and many more.

I don't see how one can stuff all that into a statically 
available, datastructure without blowing out compile times.


More information about the Digitalmars-d mailing list