<div class="gmail_quote">On 9 January 2012 12:01, Martin Nowak <span dir="ltr"><<a href="mailto:dawg@dawgfoto.de">dawg@dawgfoto.de</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Am 04.01.2012, 15:33 Uhr, schrieb Vladimir Panteleev <<a href="mailto:vladimir@thecybershadow.net" target="_blank">vladimir@thecybershadow.net</a>>:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
On Wednesday, 4 January 2012 at 14:28:07 UTC, Andrei Alexandrescu wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hmmm, I see that the other way around. D CTFE-generated macros are much easier to debug because you can actually print the code before mixing it in. If it looks like valid code... great.<br>
</blockquote>
<br></div>
Paging Don Clugston: would it be feasable to have the compiler remember the source position of every single char/string literal or compile-time-evaluated string expression?<br>
<br>
I'm thinking that if the compiler tracks the source of every string/char literal in the source code, all across to any manipulations, debugging CTFE-generated code would be a lot easier - the compiler would emit error messages pointing inside string literals, and debuggers could step inside code in string literals. (The one thing this doesn't allow is allowing debuggers to step through a DSL with no D code in it.)<br>
<br>
The naive implementation would store the position of every character, which would blow up the memory usage by about 13 times or so on 32-bit? (For every character, add a struct with 3 fields - char* filename; int line, column). A rope-like structure could cut down on that but possibly drastically complicating the implementation.<br>
</blockquote>
<br>
Last time I generated big and complex mixin I let the compiler<br>
output mixins to separate files. This gives you nicer debugging<br>
and readable error lines.<br>
<a href="https://github.com/D-Programming-Language/dmd/pull/426" target="_blank">https://github.com/D-<u></u>Programming-Language/dmd/pull/<u></u>426</a><br>
</blockquote></div><br><div>Amazing idea, this should be standard!</div><div>That totally changes my feelings towards mixins :)</div>