On Friday, 10 June 2016 at 22:38:29 UTC, Dechcaudron wrote:
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 :/

Mixins are statements. They cannot be a part of an expression.

The other two posts have demonstrated how to get around this.

Reply via email to