[Issue 1023] New: Struct implementing interfaces and struct member enumeration

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Mar 4 12:47:17 PST 2007


http://d.puremagic.com/issues/show_bug.cgi?id=1023

           Summary: Struct implementing interfaces and struct member
                    enumeration
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla at digitalmars.com
        ReportedBy: larsivar at igesund.net


Structs in D are very simple which is good, but in some cases they are just
too simple. In many cases you would want to handle struct instances as if
they were Object derivates, by calling methods on them, methods that
implement an interface. The most obvious example is toUtf8 (or toString).
As it is now, for instance in a formatter, if it detects that the input is
a struct, you have no way of figuring out whether the struct implements an
interface or not.

This is thus a request to make it possible to say that a struct implements
an interface and thus can be typeid'ed on other types (interfaces) than
those of the structs themselves. An enumeration of the methods of the
struct would also be nice.

I started a thread in the NG out of old habit, but I think this is the more
correct place.


-- 



More information about the Digitalmars-d-bugs mailing list