[Issue 10378] Local imports hide local symbols

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Wed Jan 20 12:29:12 PST 2016


https://issues.dlang.org/show_bug.cgi?id=10378

--- Comment #20 from Steven Schveighoffer <schveiguy at yahoo.com> ---
(In reply to Ketmar Dark from comment #19)
> ah, i see, thank you. i really misread the suggesion. still, i like Kenji's
> PR4915 more. ;-) i'd better see "shadowing error", so i can simply rename
> symbols, and don't guess if there is conflict or not.

Yes, thank you Timon for explaining better.

The main reason I see local imports being useful is this:

import somemodule;

void foo()
{
   onlyPlaceSomeModuleIsUsed()
}

Now, one can simply say "wait, somemodule isn't something everyone in the file
needs, just foo. I'll move it inside"

And then it breaks. I'd rather just see it work the same. All you are doing is
saying who has access to somemodule's symbols, and avoid polluting the module
namespace.

--


More information about the Digitalmars-d-bugs mailing list