www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Missing typeinfo

reply one_mad_alien hotmail.com writes:
I can not get the typeinfo from array of arrays 
in Java Arrays are object so int[][].getClass()
returns class of Object[] (whose contained class is int[])

I think the D typeinfo should follow a similar model
there should be a typeinfo for 'Array of T'
so T[][] is array of (T[])
(R being T[])
int[].typeinfo => TypeInfo_R; TypeInfo_R.contained => TypeInfo_int;
int[][].typeinfo => TypeInfo_R; TypeInfo_R.contained => TypeInfo_R;
TypeInfo_R.contained => TypeInfo_int;

int[].typeinfo => TypeInfo_Rint; 
TypeInfo_Rint.contained => TypeInfo_int;
int[][].typeinfo => TypeInfo_R; 
TypeInfo_R.contained => TypeInfo_Rint; 


import std.c.stdio;

template typename(T) {
static int getinfo() {
return cast(int)cast(void*)T.typeinfo;
class Foo { }

int main( char[][] args ) {

printf( "(Foo[]).typeinfo=0x%X\n", typename!(Foo[]).getinfo );
printf( "(Foo[][]).typeinfo=0x%X\n", typename!(Foo[][]).getinfo );

return 0;

//  Error 42: Symbol Undefined __init_12TypeInfo_AAC
May 06 2004
parent "Walter" <newshound digitalmars.com> writes:
I need to reengineer the typeinfo stuff.
May 19 2004