Symbol lookup rules and imports
Walter Bright via Digitalmars-d
digitalmars-d at puremagic.com
Mon Dec 8 00:26:12 PST 2014
On 12/2/2014 2:00 PM, H. S. Teoh via Digitalmars-d wrote:
> 4) This isn't the end of the story. There's also this lovely bug:
>
> https://issues.dlang.org/show_bug.cgi?id=1238
>
> which, as its number should tell you, has been around for a LONG time.
> Executive summary:
>
> // mymod.d
> module mymod;
> private int impl;
>
> // main.d
> module main;
> import mymod;
>
> void impl() { ... }
>
> void main() {
> impl(); // Error: main.impl conflicts with mymod.impl (WAT?)
> }
That error doesn't happen. That isn't what 1238 is.
> Basically, the underlying cause is the same. Import pulls the symbols of
> mymod.d into the current scope
No, it does not. Symbols in the current scope override imports from the same
scope. 1238 is about private symbols from one import set against public symbols
from another import, an entirely different thing.
More information about the Digitalmars-d
mailing list