typeof()

Jacob Carlborg doob at me.com
Thu Oct 20 09:26:29 PDT 2011


On 2011-10-20 16:20, Steven Schveighoffer wrote:
> On Thu, 20 Oct 2011 10:07:12 -0400, Gor Gyolchanyan
> <gor.f.gyolchanyan at gmail.com> wrote:
>
>>> D's runtime type info is very limited, so you may not be able to get
>>> what you are looking for.
>>
>> D's compile-time type info is very rich and it's easy to remember it
>> for run-time use.
>
> Yes, but you have to do some funky stuff to link it to the typeinfo.
> Compare this to other languages where the compiler generates a very rich
> set of runtime info (e.g. Java).
>
> I think actually, the runtime info generated by the compiler is seldom
> used (except for maybe dynamic casting), and just creates bloat.
>
> I envision in the future, the runtime info generated would be triggered
> by an annotation like @rtti("functions", "fields", "inheritance"). That
> would give us a good hook to selectively generate rtti when it makes sense.
>
> -Steve

And the you get big problems when you want to use the runtime info of a 
type you don't control and it doesn't use that attribute.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list