IFTI for constructors worth a DIP?

Dmitry Olshansky dmitry.olsh at gmail.com
Fri Mar 30 06:25:48 UTC 2018


On Friday, 30 March 2018 at 06:21:27 UTC, Dmitry Olshansky wrote:
> I think it should be mostly stright-forward and we can get rid 
> of “instantiator” functions to do IFTI.
>
> The problem (I guess) is 2 type parameter lists, one of 
> aggregate and the other of function:
>
> struct Foo(T)
> if (isSomeSuch!T)
> {
>     this(U)(T a, U u) if (isSomethindElse!U) {...}
>     this(R)(T x, R r) if (yetAnother!U){ ... }
> }

More interesting case...
struct Foo(T)
{
      alias K = T.K;
      this(K k) { .... }
      // same
}

In general it might be impossible (if we throw in more static ifs 
on T’s type) but well IFTI is not 100% solution anyway.

>
> I believe in such a case compiler can as far as IFTI goes just 
> consider a combined tuple of types.
>
> Thoughts?




More information about the Digitalmars-d mailing list