I'm obviously doing something wrong, but don't quite understand.
mixin template helper() {
mixin("writeln(12);");
}
struct Foo {
void opDispatch(string name)() {
import std.stdio;
mixin helper!();
//mixin("writeln(12);");
}
}
void main() {
Foo.init.opDispatch!"bar"();
}
The compiler emits these errors about the mixin ("writeln(12);"):
unexpected (
in declarator
basic type expected, not 12
found 12
when expecting )
no identifier for declarator writeln(_error_)
semicolon expected following function declaration
declaration expected, not )
Why does the commented code work but the mixin not? Thanks for any pointers.