Re: C++ Frequently Questioned Answers
David Abrahams wrote:
Yes. Exception specifications are a technical success
In what sense?
They are easily implementable and work according to the Standard (i.e. a
technical success). They aren't useful, though (i.e. a semantic failure).
but a semantic failure, and export is both a technical and semantic
failure.
I guess that's where we differ -- I don't see namespaces as an attempt
at modules, failed or otherwise. In fact, I have a hard time seeing
enough similarity to figure out how they could be viewed as an attempt
at modules, period. A namespace defines a scope for names -- nothing
more and nothing less.
In aiming so low, namespaces aren't much of a solution to
anything. You could just as well use prefix_name rather than
prefix::name.
Just like you could also write this->member when "member" would do.
At least that practice serves some practical purpose in C++.
We use prefixes to avoid macro name clashes, but we don't like it.
Prefixes suck. Namespaces allow expressive code without name clashes,
because local names and explicitly-imported names from other modules
can be used without qualification. As I've implied elsewhere, ADL is
the only thing that messes that up.
What also messes it up (and motivated the development of overload sets
in D) is when you import namespaces so you can skip the explicit
qualification, then later import another namespace with conflicting
names, and now your source code is all messed up. (ADL is C++'s partial
answer to that problem.)
----
Walter Bright
Digital Mars C, C++, D programming language compilers
http://www.digitalmars.com
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]