Recursive mixins problem

Max Samukha samukha at voliacable.com
Sat Apr 7 06:55:16 PDT 2007


Why recursive mixins are disallowed?

template Call(A...)
{
    static if (A.length > 0)
    {
        void call(A[0] fn)
        {
        }

        mixin Call!(A[1..$]);
    }
}

class Caller(A...)
{
    mixin Call!(A);
}

void main()
{
    auto caller = new Caller!(int delegate(), char[] delegate());
}

hello.d(15): mixin hello.Caller!(int delegate(),char[]
delegate()).Caller.Call!(int delegate(),char[]
delegate()).Call!(char[] delegate()).Call!() recursive mixin
instantiation
hello.d(26): template instance hello.Caller!(int delegate(),char[]
delegate()) error instantiating








More information about the Digitalmars-d-learn mailing list