Thread overview
[Issue 2218] New: "builtin" typeinfos for arrays of basic types do not inherit TypeInfo_Array
Jul 11, 2008
d-bugmail
Aug 07, 2008
d-bugmail
Aug 08, 2008
d-bugmail
Feb 07, 2009
d-bugmail
Feb 07, 2009
d-bugmail
Feb 12, 2009
d-bugmail
July 11, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2218

           Summary: "builtin" typeinfos for arrays of basic types do not
                    inherit TypeInfo_Array
           Product: D
           Version: 1.029
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: trivial
          Priority: P2
         Component: Phobos
        AssignedTo: bugzilla@digitalmars.com
        ReportedBy: tomas@famolsen.dk


This is mostly just an inconsistency, but it does break some kinds of code. Namely dynamically casting for stuff like:

auto ati = cast(TypeInfo_Array)typeid(int[]);
assert(ati !is null); // fails

Trivial to fix, just inherit from TypeInfo_Array instead of TypeInfo in the internal typeinfo directory.

Probably this issue has been around forever!


-- 

August 07, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2218


bugzilla@digitalmars.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




------- Comment #1 from bugzilla@digitalmars.com  2008-08-07 18:26 -------
You shouldn't need to ever cast to TypeInfo_Array. To get the base type of the
array, call next().


-- 

August 08, 2008
http://d.puremagic.com/issues/show_bug.cgi?id=2218





------- Comment #2 from tomas@famolsen.dk  2008-08-08 11:19 -------
What is the point of TypeInfo_Array then?


-- 

February 07, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2218


dhasenan@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dhasenan@gmail.com




------- Comment #3 from dhasenan@gmail.com  2009-02-07 14:45 -------
*** Bug 2650 has been marked as a duplicate of this bug. ***


-- 

February 07, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2218


dhasenan@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |




------- Comment #4 from dhasenan@gmail.com  2009-02-07 14:53 -------
I understand that I should never have to cast from TypeInfo_Ai to TypeInfo_Array. That's not what I'm trying to do. I want to cast from TypeInfo to TypeInfo_Array to see if a type is an array (and then get the value type).

This should be a relatively simple change and would make runtime reflection a fair bit more powerful -- not in terms of what you can do, perhaps, but certainly in terms of what information you can gather.

And no, it's *not* an option to try casting to TypeInfo_Ai, then TypeInfo_Aw, then TypeInfo_Ag, ad nauseum.


-- 

February 12, 2009
http://d.puremagic.com/issues/show_bug.cgi?id=2218


dhasenan@gmail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|                            |INVALID




------- Comment #5 from dhasenan@gmail.com  2009-02-11 18:34 -------
HAHAHA DISREGARD THAT.

I didn't see that TypeInfo has next().

Still, it's extremely hacky to determine whether a type is an array by checking whether the tenth character in its classname is 'A'.


--