The following shows that alias cannot be used to override a function that is requested by an interface.
luckily the mixin does work, but I think that also the alias version should work... (I find it cleaner)
I tested both in D1 and D2.
{{{
interface II{
void f(int);
void f(double);
}
template pr(T){
void f(T i){
// do something
}
}
class A:II{
void print(T)(T i){
// do something
}
version(works){
mixin pr!(int);
mixin pr!(double);
} else { // fails
alias print!(int) f;
alias print!(double) f;
}
}
}}}
Comment #1 by fawzi — 2009-11-04T08:25:54Z
For completness I forgot to say that also
{{{
alias print!(int).print f;
}}}
does not work, and with the mixin to *really* have it working you need the mixin (that mixes in the things with the correct name to remove the interface error), and alias (to make overloading actually work).
Definitely ugly
Comment #2 by robert.schadek — 2024-12-13T17:50:53Z