[Issue 1728] alias hides mixin member func?

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Dec 9 05:18:55 PST 2008


http://d.puremagic.com/issues/show_bug.cgi?id=1728





------- Comment #4 from jarrett.billingsley at gmail.com  2008-12-09 07:18 -------
(In reply to comment #3)
> This is not a bug.
> 
> The mixin establishes its own scope that is nested inside B's scope. If there
> is no print in B's scope, it will look in the mixin. If there is a print in B's
> scope, it will not look in the mixin.
> 
> This works exactly the same as imports and symbols at module scope.
> 
> The solution is to bring the desired members of mixtem up into B's scope. 

That works fine for normal methods, but how about ctors?  I actually ran into
this.

template mixtem()
{ 
        this(char[] t)
        {
                Stdout.formatln(t);
        }
}

class A
{
        mixin mixtem;

        this()
        {
                this("OK"); // same error as the OP
        }
}

Except of course "mixin mixtem M; alias M.this this;" is not legal.  (I also
tried using the weird _ctor but that doesn't work either.)


-- 



More information about the Digitalmars-d-bugs mailing list