Thread overview
[Issue 8059] New: Deprecate .classinfo
May 10, 2012
Marco Leise
May 10, 2012
Marco Leise
May 07, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8059

           Summary: Deprecate .classinfo
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: minor
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: schveiguy@yahoo.com


--- Comment #0 from Steven Schveighoffer <schveiguy@yahoo.com> 2012-05-07 04:35:49 PDT ---
Since 2.037, this function will always pass:

checkClass(Object o)
{
   assert(typeid(o) is o.classinfo);
}

Isn't it about time .classinfo was deprecated?  It's still in the docs, and still compiles.  It isn't mentioned in TDPL.

Is there a reason to keep it?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 07, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8059



--- Comment #1 from Steven Schveighoffer <schveiguy@yahoo.com> 2012-05-07 04:38:39 PDT ---
See also issue 3346

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 07, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8059


Alex Rønne Petersen <xtzgzorex@gmail.com> changed:

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


--- Comment #2 from Alex Rønne Petersen <xtzgzorex@gmail.com> 2012-05-07 04:40:25 PDT ---
I think the intention has always been to deprecate it. It's about time we actually do so.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 10, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8059


Marco Leise <Marco.Leise@gmx.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |Marco.Leise@gmx.de


--- Comment #3 from Marco Leise <Marco.Leise@gmx.de> 2012-05-10 12:03:05 PDT ---
typeid(x) doesn't work in all cases where x.classinfo works (on 2.057/2.059).
Something along the line of:

TypeInfo_Class[string] lookup;

class Foo
{
    mixin Register!("foo");
}

template Register(string Trigger)
{
    static this()
    {
        lookup[Trigger] = this.classinfo; // ok
        // lookup[Trigger] = typeid(this); <- 'this' is only defined in
non-static member functions, not _staticCtor13
    }
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 10, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8059



--- Comment #4 from Steven Schveighoffer <schveiguy@yahoo.com> 2012-05-10 14:02:39 PDT ---
(In reply to comment #3)
>         // lookup[Trigger] = typeid(this); <- 'this' is only defined in
> non-static member functions, not _staticCtor13

typeid(typeof(this))

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 10, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8059



--- Comment #5 from Steven Schveighoffer <schveiguy@yahoo.com> 2012-05-10 14:05:00 PDT ---
Also see above referenced bug 3346 that specifically identifies classinfo as behaving abnormally.  Looks like you found another case!

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 10, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8059



--- Comment #6 from Marco Leise <Marco.Leise@gmx.de> 2012-05-10 14:09:07 PDT ---
Ah, thank you for that hint. So my code would survive the deprecation, if just by chance.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------