Re: C++ Frequently Questioned Answers
Jerry Coffin wrote:
In article <qOydncgL97IVsLDanZ2dnUVZ_rSrnZ2d@comcast.com>,
walter@digitalmars-nospamm.com says...
I agree it doesn't rise to the level of "proof", but then again, it is a
reasonable argument that there are serious shortcomings in the design of
namespaces. But if you don't agree, that's ok, I'll just present another
one: exception specifications (other than nothrow). As proof (!), I've
never noticed e.s. (other than nothrow) used anywhere outside of a test
suite.
I'm not sure what you're really trying to show here -- I thought we were
discussing namespaces, but it sounds like you're primarily intent on
showing that some of the "features" in the original C++ standard weren't
well thought out and haven't worked well in practice.
I'm trying to show that it's not a done deal that concepts are the
right, or even an effective, answer to the problem C++ has with
incomprehensible error messages. It will take years of experience with
concepts to determine if they are the solution.
As evidence of this, I brought up some other features of C++ that were
standardized with little or no experience with them, and subsequent
experience with those features was disappointing.
One way to mitigate these problems is to adopt successful features from
other languages, or to require that at least one widely available
implementation of each new feature exist before standardization. Concept
gcc is doing that.
I tend to agree with that overall: exception specifications and export
(to name a couple of obvious ones) haven't shown any real utility, at
least IMO. I even use Comeau C++, one of the only compilers to implement
export, and I still don't use it in any real code.
Exception specifications are, IMO, even worse: I'm not sure export buys
a lot, but I think exception specifications are actively harmful to your
code as a rule.
Yes. Exception specifications are a technical success but a semantic
failure, and export is both a technical and semantic failure.
I tend to view namespaces as a failed attempt at modules. It's good that
Daveed is trying to fix it. But I sure hope that Daveed's proposal gets
some wide use to prove its efficacy before freezing it into the
standard. It's too hard to tell just by looking at a spec.
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.
Modules, at least as usually defined (and Daveed's proposal is in accord
on this point) have much broader implications for things like order of
initialization and overall program organization. The fact that they
happen to also define a scope is important, but hardly their sole, or
even primary, reason for existence.
Well, yes!
----
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! ]