I just figured out half of my frustration is caused by a
collision between the 'alias this'd template possibillity and the
normal one.
For example:
struct Bar(uint size, V) {
V[size] blup;
alias blup this;
}
void foo(S : T[], T)(S a) {
pragma(msg, "first");
}
void foo(S : Bar!(T, U), uint T, U)(S a) {
pragma(msg, "second");
}
Bar!(2, int) bar;
foo(bar);
Will cause "called with argument types `(Bar!(2u, int))` matches
both:DUB"
(And "undefined identifier `T`DUB", "undefined identifier
`U`DUB", but thats a false positive :/)
While removal of either will make it work fine, as would removal
of the alias.
Templating:
The template picked to instantiate is the one that is most
specialized that fits the types of the TemplateArgumentList.
Alias this:
If an aggregate declaration defines an opCmp or opEquals
method, it will take precedence to that of the aliased this
member.
I was of the impression D only defaulted to the alias when the
original implementation of a (member) function was missing /
disfunctional. Shouldn't aliasing also follow this logic when
using template specializations? (Even though it may not be a
member function)