[Issue 11124] support "is (T : struct)" syntax

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Sep 25 10:33:28 PDT 2013


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



--- Comment #6 from Kenji Hara <k.hara.pg at gmail.com> 2013-09-25 10:33:27 PDT ---
(In reply to comment #4)
> (In reply to comment #2)
> > And, how this will work when multiple alias this is properly implemented?
> 
> I don't understand the problem? Isn't it the same as, say: "is (C : int)"?

Today,
1. is(T U == super) captures the super class list of T in U.

  class C : Object {}
  static if (is(C U == super)) { static assert(is(U[0] == Object)); }

2. If T is implicitly convertible to U, is(T X : U) captures T in X.

Then, if multiple alias this is supported:

  struct S1 {}
  struct S2 {}
  struct S {
    S1 s1;  alias s1 this;
    S2 s2;  alias s2 this;
  }
  static if (is(S U : struct)) { /* What's captured in U? */ }

Based on the #1, U would capture the tuple of S1 and S2.
Based on the #2, U would capture the type S.

Which is chosen? Or other choices?

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


More information about the Digitalmars-d-bugs mailing list