On Friday, 13 April 2018 at 21:20:26 UTC, Ikeran wrote:
On Friday, 13 April 2018 at 20:50:38 UTC, bauss wrote:
What I'm doing is basically this:
    static foreach (viewResult; generateViewsResult)
      pragma(msg, "Compiling: " ~ viewResult.name);
      pragma(msg, "Compiled: " ~ viewResult.name);

I would've expect the compiling to be before the error message, but the compiled after the error message.

However it seems like it doesn't do that, but as I can't reproduce it I'm just wondering what causes it.

The compiler is free to examine your source code in any order that produces the same artifacts on success and self-consistent error messages otherwise. In this case, it evaluated the pragmas and the `mixin` in one pass, then the function body in a separate pass.

The best way I've found to debug mixins is to pragma(msg) the code I wanted to mix in, then insert it myself.

The problem is I can't pragma(msg) the code I want to mixin manually since all mixins are dynamically generated. That's why my only way is to do it within that static foreach.

I have no control over how many mixins there are and only to an extend what they contains.

Basically what I'n doing is I have a file named views.config in which each like contains something like:


The name is what's in viewResult.name and the content of file.dd is what's in viewResult.source (But parsed and wrapped into a valid D class)

I initially tried to just use __traits(compiles) but it fails even on the valid generated D code.

Reply via email to