On Fri, 04 May 2012 01:13:07 -0400, Mehrdad <wfunct...@hotmail.com> wrote:

Hmm... how exactly do you use RTInfo? (Is it usable yet? All I see is a void* and a dummy template.)

You have to fill in object.di's RTInfo(T) to be whatever you want. As I said, it's very beta, intended as a hook to use for more precise garbage collection, or any other runtime info goodies you want to put in there. See my example for a hint.

Essentially, the compiler's going to do this:

class C {...}

// compiler: hmmm... have to generate TypeInfo_Class for C. Let me set up all the normal hooks

TypeInfo_Class CTypeInfo;
CTypeInfo.name = "C";
...

// compiler: ok, now let me generate the RTInfo part
CTypeInfo.m_rtInfo = RTInfo!C;

Now, you can call typeid(instanceOfC).rtInfo and it will give you the data that comes from RTInfo!C. And you don't have to know the type of instanceOfC, it could be Object. It's essentially a way to convert compile-time data into runtime data.

-Steve

Reply via email to