local import hijacking
Byron Heads via Digitalmars-d
digitalmars-d at puremagic.com
Thu Jan 14 07:13:37 PST 2016
On Thursday, 14 January 2016 at 14:56:39 UTC, Byron Heads wrote:
> On Thursday, 14 January 2016 at 14:36:23 UTC, Daniel Kozak
> wrote:
>> [...]
>
>
>
> 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 at 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...
Also why is this not allowed then?
import std.stdio;
void main() {
auto x = "foo";
for(int x = 0; x < 10; ++x) {
writeln(x);
}
}
Error: variable x is shadowing variable f335.main.x
Shadowing is bad and leads to bugs!
More information about the Digitalmars-d
mailing list