[Issue 14438] New: is(A P == super) (tuple of supertypes) should work with structs and alias this

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Fri Apr 10 09:52:10 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14438

          Issue ID: 14438
           Summary: is(A P == super) (tuple of supertypes) should work
                    with structs and alias this
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: DMD
          Assignee: nobody at puremagic.com
          Reporter: andrei at erdani.com

Currently D offers a means to get all supertypes (base class and implemented
interfaces) of a class types with this construct:

static if (is(C P == super))
{
}

Inside the static if, P is a tuple starting with the base class and continuing
with all implemented interfaces, in lexical order.

Now consider:

struct S(T)
{
    private T datum;
    T fun() { return datum; }
    alias fun this;
}

There is no introspection mechanism that, given S, finds T. There should be
one, and it should work with the upcoming multiple alias this.

I think it's fine if we use the same syntax.

--


More information about the Digitalmars-d-bugs mailing list