On Thursday, 14 January 2016 at 14:36:23 UTC, Daniel Kozak wrote:
V Thu, 14 Jan 2016 14:25:43 +0000
Byron Heads via Digitalmars-d <digitalmars-d@puremagic.com> napsáno:

I got burned by this yesterday, this code should not compile

import std.experimental.logger : trace;


void foo() {
        import std.net.curl : trace;
        trace("hello");
}


void main() {
        foo();
}


Not sure if this is a duplicate https://issues.dlang.org/show_bug.cgi?id=15567




No this is OK, there is no reason to not compile.

It is same as:
import std.stdio;

string trace = "trace";
void foo() {
    int trace = 7;
    writeln(trace);
}
void main() {
    foo();
    writeln(trace);
}


local symbols can hide global symbols



import std.experimental.logger;
void foo() {
        import std.net.curl;

        .... lots of curl calls

        trace("hello");

        .. more curl calls
}


void main() {
        foo();
}

std.net.curl.CurlException@std\net\curl.d(4033): Couldn't resolve host name on handle 2188398
----------------
0x00405F65
0x00405F10
0x0040275B
0x0040259E
0x0040202B
0x00402035
0x004257A7
0x004256A8
0x0041B7FF
0x769F337A in BaseThreadInitThunk
0x77429882 in RtlInitializeExceptionChain
0x77429855 in RtlInitializeExceptionChain

This was a 4 hour debug which made it worse as I was adding more trace calls to figure out what was going on. My boss is now on the fence, to many compiler bugs with D, he asked me to switch to Java if I have to deal to many more issues like this.. (https://issues.dlang.org/show_bug.cgi?id=15457 another issue we had)

And this awesome stack trace helped me so much to track this issue down...


Reply via email to