public import and bugs it causes

Alex Makhotin alex at bitprox.com
Fri May 14 10:16:06 PDT 2010


Hello.

Today I found a strange bug in my code which was caused by 'public 
import' declaration from the wxD library.

The library imports publicly the 'std.compiler' module from Phobos.
And it has the 'const string name;' declaration.
Some of the code of my program imported the library headers.
None of the classes of the program have the 'name' member or any static 
analogs. I just wanted to know why in some cases the program printed the 
magic "Digital Mars D" words :). At that time I found the public import 
of the 'std.compiler' module in the code of the library.

Well, I'm not against the additional promotion of the Digital Mars D 
compiler :)

But, I don't want such occasions any more. Is there a solution, except 
to avoid public imports(by the way, I avoid, it's the library code from 
the third party)? The ideal would be a warning from the compiler, at least.
I also would like the compiler to force me to use fully qualified module 
path to the member in the mentioned case.


-- 
Alex Makhotin,
the founder of BITPROX,
http://bitprox.com


More information about the Digitalmars-d mailing list