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

Edward Diener eddielee_no_spam_here at tropicsoft.com
Mon Jan 28 20:40:22 PST 2008


Christopher Wright wrote:
> Edward Diener wrote:
>> Xinok wrote:
>>> Edward Diener wrote:
>>>> I have searched through the pdf documentation bit did not find a full
>>>> explanation of RTTI facilities in D. The reason I ask about this is 
>>>> that
>>>> it appears there is a 3rd party reflection facility but I do not see 
>>>> the
>>>> documentation in D that explains if and how reflection works in D. Does
>>>> it exist in D ? Is there documentation for it ?
>>>>
>>> D 2.0 is an experimental branch which supports compile time 
>>> reflection. It's documented here:
>>> http://digitalmars.com/d/2.0/traits.html
>>
>> That is compile-time reflection, which is useful for creating code but 
>> not for instantiating objects at run-time and finding out about them. 
>> It is also very limiting in the form presented as one can not 
>> instantiate objects in the compile time constructs based on the 
>> information returned, but just react in a way to the information 
>> found. I am not putting down the effort as it more than duplicates and 
>> is more effective than the Boost traits library, since it is based on 
>> compiler knowledge.
> 
> Also, you can use the classinfo for a type to create new instances of 
> that type, provided that type has a default constructor (one that can be 
> called with no arguments). That doesn't let you do a whole lot, I 
> realize, but it's better than nothing.

I do not see any information in the docs about classinfo. Perhaps these 
things do not exist in D 1.0 and are there somewhere in D 2.0 . But 
without real docs for D 2.0 I will wait until there is some.



More information about the Digitalmars-d mailing list