how to determine a runtime type faster?

davidl davidl at 126.com
Thu May 10 06:16:42 PDT 2007


module funky.super.meaningless.modulename;
class base
{
}
class derive:base
{
}
void main()
{
     derive instance= new derive;
     base castedinstance=instance;
     // notice the following would result a super long string comparision ,  
which is not so good.
     //  
`funky.super.meaningless.modulename.derive`==`funky.super.meaningless.modulename.derive`
     assert(castedinstance.classinfo.name==derive.classinfo.name);

}
the idea is castedinstance.classinfo.runtimeid?
the runtimeid could generated by the compiler and with some proper design  
about object.d , i think
the comparision could be faster



More information about the Digitalmars-d mailing list