Pathological import symbol shadowing
Walter Bright
newshound2 at digitalmars.com
Sat Nov 21 02:07:05 UTC 2020
On 11/17/2020 5:19 PM, Paul Backus wrote:
> On Wednesday, 18 November 2020 at 01:11:35 UTC, Walter Bright wrote:
>> Please elaborate on what is invalid about it? Don't make me guess!
>
> Because std.file is imported locally, the call to write calls std.file.write
> instead of std.stdio.write, and overwrites important_data.txt.
Ok, and that's how scoped name resolution works. It's not invalid.
> If `import std.file` is moved to module scope, the compiler correctly diagnoses
> that the call is ambiguous.
Yes. This is why I asked, as I wondered if I was missing something.
More information about the Digitalmars-d
mailing list