digitalmars.D.bugs - Missing typeinfo
- one_mad_alien hotmail.com (30/30) May 06 2004 I can not get the typeinfo from array of arrays
- Walter (1/1) May 19 2004 I need to reengineer the typeinfo stuff.
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; or int[].typeinfo => TypeInfo_Rint; TypeInfo_Rint.contained => TypeInfo_int; int[][].typeinfo => TypeInfo_R; TypeInfo_R.contained => TypeInfo_Rint; etc. --------------------------------------------- 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