public import and bugs it causes
Walter Bright
newshound1 at digitalmars.com
Fri May 14 13:55:31 PDT 2010
Alex Makhotin wrote:
>> The designer of an imported
>> module has complete control over what names will be visible to the
>> importer and which aren't. This is as it should be.
> I don't want to deal with the bad design of someone's module.
You're always going to be stuck with the design of someone else's module if you
choose to use it.
> For example.
>
>> module Server.TestM2;
>> const string name = "New Name";
>
>> module Server.TestM1;
>> public import Server.TestM2;
>
>> module Server.Main;
>> private import Server.TestM1;
>
> In the scope of Server.Main module the global variable 'name' is visible.
> That should not be so.
That's up to the author of TestM1. If he doesn't want the names in TestM2 to be
visible, he should privately import TestM2.
More information about the Digitalmars-d
mailing list