On Friday, 21 August 2020 at 22:34:49 UTC, Adam D. Ruppe wrote:
On Friday, 21 August 2020 at 22:12:48 UTC, Steven Schveighoffer wrote:
Who does that though?

An incompetent coder:

http://dpldocs.info/experimental-docs/source/arsd.cgi.d.html#L5713
http://dpldocs.info/experimental-docs/source/arsd.cgi.d.html#L5943
http://dpldocs.info/experimental-docs/source/arsd.cgi.d.html#L6018
http://dpldocs.info/experimental-docs/source/arsd.cgi.d.html#L6058

Even this approach can lead to unclear result if you move 'q{...}' outside of mixin:
=========================
void test(string file = __FILE__, size_t line = __LINE__)
{
    writefln("file: '%s', line: '%s'", file, line);
}

int main(string[] args)
{
    enum code = q{
        // empty line 15
        // empty line 16
        // empty line 17
        // empty line 18
        // empty line 19
        test(); // line 20
    };

    test();        // line 23
    mixin(code);   // line 24
    test();        // line 25
    return 0;      // line 26
}                  // line 27
===========================

The output is the following:
file: 'test.d', line: '23'
file: 'test.d-mixin-24', line: '30'
file: 'test.d', line: '25'

Note that there is no line 30!

Reply via email to