On Monday, 22 April 2013 at 09:03:24 UTC, Peter Alexander wrote:
mixin template A() {
    extern(C) int foo() { return 1; }
}

mixin template B() {
    extern(C) int foo() { return 2; }
}

mixin A a;
mixin B b;

void main() {
    int x = a.foo() + b.foo();
}

If both foo's have the same symbol, then how am I able to disambiguate them in code?

Maybe duplicate extern(C) template mixin symbols need to be an error?

If there are true duplicates then it would need to be an error. However, if a mixin uses a mixin identifier then it's going to need to be mangled anyway, so only

mixin A;
mixin B;

would have to be an error. It already is an error, but unfortunately only when you reference the content of the mixin, not at the mixin statement.

Reply via email to