Jeremie Pelletier wrote:
Me neither, in fact I would *love* to see a -nrtti switch in DMD to
disable the generation of all ClassInfo and TypeInfo instances, along
with a version identifier, maybe "version = RTTI_Disabled;" to let code
handle it.
I use RTTI a lot for simple debugging like printing the name of a class
or type in generic code or meta programming, but not at all in
production code. Most of the time I can rely on .stringof and a message
pragma to do the same.
You use RTTI for dynamic casts, variadic functions, and the default
implementation of toString. You could safely eliminate some fields from
ClassInfo and TypeInfo, but you can't get rid of them entirely.
The best you can do is make TypeInfo entirely opaque (no fields) and
only include the base class, interfaces, and name for ClassInfo.