Mixin helper help

Ali Çehreli acehreli at yahoo.com
Fri Jan 13 16:54:34 UTC 2023


On 1/13/23 00:48, bauss wrote:

 > 1. Change your mixin template to something like this:

There was a technique as a workaround for this template mixin limitation 
but I can't find it right now.

 > 2. Change the place where you instantiate to this:

I think the workaround I am trying to remember would not require any 
change for the users.

Ok, it was something like this:

mixin template myStatement() {
     auto doIt() {
         import std.stdio : writeln;
         writeln("hi");
         return 0;
     }

     auto ignoreThis = doIt();
}

void main() {
     mixin myStatement!();
     mixin myStatement!();
}

Ali



More information about the Digitalmars-d-learn mailing list