Strange Mixin issue

Frustrated Frustrated at nowhere.com
Wed Mar 5 15:33:24 PST 2014


Maybe the problem isn't what I thought it was. I created a test 
case that works:

import std.stdio, std.cstream;

mixin template C()
{
	alias A = typeof(this);
	mixin(B!(A));
}

template B(T)
{
	pragma(msg, T);
	enum B() { return "string foo() { return `<"~T.stringof~">`; }"; 
}
}

class A
{
	//mixin(B!(A));
	mixin C;
}


void main()
{
	auto a = new A;
	writeln(a.foo());
	//a.B();
	din.getc();
}


Note the difference in calls. C is much easier because you don't 
have to pass the parent type. This is all I'm trying to achieve 
in the other code but when I do the functions(foo in this case) 
do not get mixed in.



More information about the Digitalmars-d-learn mailing list