Newbie initial comments on D language - RTTI and run-time reflection

Edward Diener eddielee_no_spam_here at tropicsoft.com
Tue Jan 29 19:13:45 PST 2008


Robert Fraser wrote:
> Edward Diener wrote:
>>> There is flectioned (http://flectioned.kuehne.cn/), likely the 
>>> library you mentioned.  The D compiler by default inserts some RTTI 
>>> information, but it's not complete by any means.
>>
>> Yes, that is the library but I have not looked at it yet myself. 
>> Because it mentioned reflection, I assumed that run-time reflection 
>> must be available in D in some form.
> 
> It loads an image of the executable and enumerates through the symbols 
> that were compiled in.

Then it has knowledge the internal structure of a module via some 
facility. Is this facility based on some library which gives this 
knowledge ? Is the internal module structure rich enough to allow all of 
the necessary information about types and their sub-components ?

If all this is true, then one has at least run-time reflection in the 
sense that information can be extracted, because the data for reflecting 
through the types is part of the module structure. I could care less 
whether the facility was based on some language internals or a library 
which exposed the information. I wasn't implying that the D language 
should have built-in facilities for run-time reflection but only that 
the final module should allow all of the necessary information about the 
types and its sub-components to be extracted. If all this is true, it is 
excellent news. since then the types of a module can be extracted from 
the module.

But that is still only half the story. Run-time reflection in a RAD 
environment needs the ability to be able to create an object directly 
from the type of that object, and the type of an object must itself be 
instantiable as an object. This final ability is in Java, Python, .Net, 
and C++ Builder/Delphi. I can only encourage D to have this ability also.



More information about the Digitalmars-d mailing list