On Monday, 23 April 2012 at 03:17:49 UTC, Xinok wrote:
I know this has probably been asked for a hundred times before,
but I don't understand why D doesn't support this. Template
alias parameters can accept nearly anything as an argument that
standard aliases don't. I think standard aliases should be
equally as powerful as their template counterpart.
If you can write this:
template Eval(alias arg){ alias arg Eval; }
alias Eval!(cond ? a : b) al;
Why not simply allow this?
alias (cond ? a : b) al;
Or perhaps this:
alias al = cond ? a : b;
Do equivalent expressions instantiate the same template?
class Foo(alias E) {}
int x, y;
alias (x + y) A;
alias (x + y) B;
alias (y + x) C;
Are Foo!A and Foo!B the same type? What about Foo!C?
Either way, it will require name-mangling of arbitrary
expressions, which is just plain nasty.