What is RTInfo?

Steven Schveighoffer via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jan 29 06:59:00 PST 2015


On 1/29/15 3:47 AM, Mike wrote:
> object.d [1] says it's infomation for the precise GC (which I thought
> wasn't implemented yet).
>
> It just seems to return a void*.  But, searching the source code, it
> doesn't seem to be set by anything anywhere.
>
> So, what is RTInfo and what is its purpose.  And how is it different
> from TypeInfo?

For every TypeInfo generated by the compiler, it also instantiates the 
RTInfo(T) template [1] and puts the result into m_rtInfo.

This allows anyone to generate anything they want at compile time and 
put it into the TypeInfo system.

Could be Precise GC stuff, could be reflection stuff, anything you want. 
At the moment it's just a toy for tinkerers to try nifty things with :) 
There has been discussion as to how we can make the system extensible, 
so you don't have to build a new runtime to add things to TypeInfo. But 
nothing concrete so far has been added. It's just a hook from the compiler.

-Steve

[1] 
https://github.com/D-Programming-Language/druntime/blob/f0c1e13d8bd547eed517b1ae17f085966bb165c1/src/object.di#L682


More information about the Digitalmars-d-learn mailing list