Ok, I wish to create a standard timing system so that I can measure ~how long each function takes to execute.

I wish to be able to place at the start of a function
version(Time) mixin TimeExecution("funcName");

mixin template TimeExecution(T) if(isSomeString!T) {
    import std.stdio, std.datetime, std.conv;

    auto sw = StopWatch(AutoStart.yes);
    //  Error: Declaration expected, not '('
    scope(exit) writeln(T, ": ", to!Duration(sw.peek));
}


Why do I receive the Error when the scope statement is included?
Is this an error, or what is the rationale behind the decision?

Thank you.

Reply via email to