Andrei Alexandrescu wrote:
I agree there are ugly constructs in D, and is-expressions would near
the top of the list (particularly the absolutely awful is(T : T[])), but
you have no case (heh) with the switch statement.
Andrei
Just a funny suggestion: could we change the is() expression to
imperative style?
Now:
template Something(T, U, V) if ( is(T : T[]) && is(...) )
{
alias T blah1;
U blah2;
class C {};
struct S {};
}
In mirror universe:
template Something(T, U, V)
in
{
static if ( T : T[] ) // static if here mean if (is (...))
{
// may do something with T, make alias, change type
// or check another constraint.
}
else
{
pragma(msg, "T must be Klingon");
static assert(false); // Or return false; ????
}
static if ( U == int )
{
V = float; // ?????
}
return true;
}
body
{
alias T blah1;
U blah2;
class C {};
struct S {};
}