typeof()
Steven Schveighoffer
schveiguy at yahoo.com
Thu Oct 20 07:20:32 PDT 2011
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
More information about the Digitalmars-d
mailing list