www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Namespaces (from comp.lang.c),

While working on Ares you might find the following discussion interesting.

Bellow is a snip from a comment made by Plauger.

 2. contrai-wise, namespaces don't seem to be particularly OO or
 strongly
 C++ like.
 3. adding *anything* to the standard is going make C more complex
 4. I think some features of C99 were a step too far and its wide-spread
 non-adoption indicates other people think the same. (I liked bool  :-)
 )
 In my opinion, C++-style namespaces could be added to C without too
 much difficulty, and without drastically increasing the complexity of
 the language.
Yes and no. First of all, namespaces are poorly designed in C++ -- they fail to solve most of the problems advanced as justification for adding namespaces to C++. Second, and IMO more important, they do nothing to solve the much larger problem in C (and C++) of controlling the scope of macro definitions. Since C does not have user-defined overloading of operators or functions, we would at least avoid the worst problems of namespaces in C++, which are only partially mitigated by argument-dependent lookup.
            On the other hand, any additional feature will make the
 language more complex, and the line has to be drawn somewhere.
Indeed. For a time in the early 1990s, I proposed picking up a number of the "simpler" C++ additions. In the end, the C committee roundly defeated all such proposals (other than // comments). In hindsight, I think the committee was absolutely right.
 And of course backward compatibility could also be an issue.  If the
 language were being designed from scratch today with namespaces,
 either the standard library declarations could be in a single
 namespace, or each header could define its own namespace -- but if
 namespaces were added today, existing code that refers directly to
 declarations from the standard headers would still have to work.
We certainly wouldn't want to imitate the disastrous decision in C++ of putting all existing headers in namespace std. P.J. Plauger Dinkumware, Ltd. http://www.dinkumware.com link: http://groups.google.com/group/comp.lang.c/browse_thread/thread/64518b74168d8028/e8a8915c6ab6e7bf?hl=en#e8a8915c6ab6e7bf Zz
Feb 06 2006