public import and bugs it causes

Walter Bright newshound1 at digitalmars.com
Fri May 14 14:50:12 PDT 2010


Alex Makhotin wrote:
> Walter Bright wrote:
>> 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.
> 
> That requires the access to the source code or the desire of the author 
> of the third party library. What if I don't have that? Deal with bugs or 
> abandon the use of the library. I would choose to abandon.

There's no getting away from problems caused by bugs in third party libraries. 
(That's why I prefer open source libraries.)

> I don't want to tolerate the unnecessary global variable 'name' in my 
> code when I privately import the Server.TestM1 module. And whatever 
> other countless unnecessary global variables the author of that(closed 
> source, commercial) module leaved for me.

You can import only those names you wish. See static imports, renamed imports 
and selective imports in http://www.digitalmars.com/d/2.0/module.html


More information about the Digitalmars-d mailing list