On Wednesday, 19 December 2018 at 15:40:50 UTC, Neia Neutuladh wrote:
On Wed, 19 Dec 2018 15:12:14 +0000, bauss wrote:
That's assuming that it's compile-time data though.

If not then you can't do what you want to do.

What you can do is wrap it in a function in the mixin template which you just call after instantiating it.

Or while instantiating it:

mixin template foo()
{
  int _ignoreme()
  {
    if (readln.strip == "abort") throw new AbortException;
    return 1;
  }
  int _alsoIgnoreMe = _ignoreme();
}
void main()
{
  mixin foo;
}

That's a genius hack.

I have to adapt this!

Reply via email to