Summary: instanceOf trait for static conditionals
           Product: D
           Version: unspecified
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Phobos

--- Comment #0 from 2012-10-05 02:23:10 PDT ---
As discussed here:

The idea would be a trait "instanceOf!T" that returns a reference to a T. The
advantage of this approach is that it allows "extracting" an instance out of T,
without ever worrying about how or where said instance came from.

This is particularly important because some types don't have T.init, and
immutables don't have T t = void. The intersection of both these groups is {0}

template isAssignable(T, U)
    enum bool isAssignable =
        is(typeof(instanceOf!T = instanceOf!U));

The "signature" (as improved on by Simen Kjaeraas) would be:
@property ref T instanceOf( T )( );
But remain un-implemented.

This would ensure it is not actually usable during run-time.

Configure issuemail:
------- You are receiving this mail because: -------

Reply via email to