TITLE: Name space management proposal PROBLEM: akkana@moab.wpd.sgi.com (Akkana Peck) Argh! Why does everybody and his brother who produces a class library insist on including a class called "String"? It makes for a developers' nightmare -- when I say String s; there's no definite way of knowing whether the compiler thinks I mean the X11 String typedef, the AT&T String, the codelibs String, some locally-written String class, the Booch String (assuming it's in fact called String, like all the others mentioned above), etc. If you're unfortunate enough to work on a project which uses two or more of the above libraries, good luck keeping all the Strings straight! Is namespace pollution no longer considered harmful? Most of the style guides I see still warn the programmer against this sort of thing, but apparently developers of software tools consider themselves to be above such warnings (or want to discourage use of anyone else's tools?) Please, people, if you're developing components you want other people to use, don't use common names like String -- at least prefix them with a few letters, e.g. AttString! RESPONSE: maxtal@extro.ucc.su.OZ.AU (John MAX Skaller), 10 Feb 93 Because its the most useful class to have. And there's no standard one. So we keep reinventing the String. My library uses 'string' (lower case 's' :-) There's a proposal by Bjarne Stroustrup to add Namespace control to C++ that will alleviate this problem. Roughly namespace MAXTAL_FANTASTIC_LIBRARY_VERSION1 { class string { ... } ... } namespace maxtal = MAXTAL_FANTASTIC_LIBARY_VERSION1; namespace YOUR_WONDERFUL_LIBRARY { class string { .. } } namespace YWL = YOUR_WONDERFUL_LIBRARY; using namespace YWL; string s; // yours maxtal::string t; // mine There's a good chance this proposal, or something similar will eventually find its way into the standard (IMHO).