www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - RTTI for templates

reply Stephan Wienczny <Stephan Wienczny.de> writes:
Hallo,

Is there a special RTTI for templates? What are the RTTI rules for
templates?
IMHO classinfo.name should reflect the type used when instancing the
template.

There is not much information about RTTI given in docs ;-(

Stephan
May 23 2004
parent reply Norbert Nemec <Norbert.Nemec gmx.de> writes:
??? Templates are no types! Could you clarify what you mean?

Currently I do not see where templates and RTTI should interfere with each
other. Templates are handled at compile-time. I do not see where
runtime-polymorphism, and with it, RTTI should come into play there.


Stephan Wienczny wrote:

 Hallo,
 
 Is there a special RTTI for templates? What are the RTTI rules for
 templates?
 IMHO classinfo.name should reflect the type used when instancing the
 template.
 
 There is not much information about RTTI given in docs ;-(
 
 Stephan

May 23 2004
parent reply J Anderson <REMOVEanderson badmama.com.au> writes:
Norbert Nemec wrote:

??? Templates are no types! Could you clarify what you mean?

Currently I do not see where templates and RTTI should interfere with each
other. Templates are handled at compile-time. I do not see where
runtime-polymorphism, and with it, RTTI should come into play there.
  

I think he may mean something like: class Thing(T) { } void main() { Thing!(int) thing = new Thing!(int); printf("%.*s\n", thing.classinfo.name); } output: Thing Parhaps the output should really be: Thing!(int)
Stephan Wienczny wrote:

  

Hallo,

Is there a special RTTI for templates? What are the RTTI rules for
templates?
IMHO classinfo.name should reflect the type used when instancing the
template.

There is not much information about RTTI given in docs ;-(

Stephan
    


-- -Anderson: http://badmama.com.au/~anderson/
May 23 2004
parent Norbert Nemec <Norbert.Nemec gmx.de> writes:
J Anderson wrote:

 I think he may mean something like:
 
 
 class Thing(T)
 {
    
 }
 
 void main()
 {
     Thing!(int) thing = new Thing!(int);
    
     printf("%.*s\n", thing.classinfo.name);
 
 }
 
 output:
 Thing
 
 Perhaps the output should really be:
 Thing!(int)

Of course it should. I would consider that just a plain bug in the implementation.
May 23 2004