Why can't I assign a mixin to an alias?

Dechcaudron via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jun 10 15:38:29 PDT 2016


I have the following code:

private string getVariableSignalWrappersName(VarType)()
{
	return VarType.stringof ~ "SignalWrappers";
}

void addVariableListener(VarType)(int variableIndex, void 
delegate(int, VarType))
{
	alias typeSignalWrappers = 
mixin(getVariableSignalWrappersName!VarType);
}

On compilation, the following error is issued:
Error: basic type expected, not mixin

Why should it be like that? I believe the compiler should not 
impose restrictions on what mixins can or cannot do :/


More information about the Digitalmars-d-learn mailing list