The point was the time delay between establishing enough of the core
language to write programs, and establishing a stable library.
Sorry, but there was considerable overlap between evolving the language
and using the new features in the library. There are even cases where
the library required a language feature *before* it was settled by
the core language subcommittee.
I'm sure some people could have said the exact right thing in fewer words,
but I couldn't. The question was why is the standard library inside
namespace std...
Because it seemed like a good idea to some, at the time. It is worth
noting that namespaces were voted into the draft C++ Standard in mid
1993, mostly as an aid for structuring the Standard C++ library;
but it quickly became apparent that the people pushing namespaces
had no idea how to use them for that purpose. As a result, the library
subcommittee revised the use of namespaces at *every* meeting for the
next two years. And they settled on the current usage over the
vehement objections of several major compiler vendors. It is no
surprise that, to this day, only one or two vendors fully conform
to the C++ Standard in the use of library namespaces. (The Dinkumware
library can be configured to do so, but practically all of our OEMs
choose not to, for good practical reasons.)
Thuse, namespace std was yet another paper tiger, which is *still*
being debugged.
...and you are gainsaying minor details. Of course The Standard broke some
existing code, just as The C Standard broke some existing code.
Well, there's "some" and there's "some". The C Standard bent over
backwards not to break existing code. Even where it did in theory,
in practice the existing code could compile properly with standard
conforming compilers. By contrast, the C++ Standard omitted *every
single* header that had been in use by the community for over a
decade. In their place it introduced a whole new set of headers
with tantalizing similarities to the old stuff, but with pernicious
differences. Some breaks didn't even involve headers or namespace
std -- like new expressions that once returned a null pointer and
now throw an exception. Some "some"s are way bigger than other
"some"s.
Yet if they had not added namespace std, the Standard language would have
been much harder to adopt for billions of lines of legacy code.
I disagree, and I think the evidence supports my position. The vast
majority of new names are in headers that older code would never
have included. The "revised" headers such as <iostream> and <new>
hew closely to past practice. And if you don't want to add several
billion "std::"s to your old code, you have to use the omnibus
"using namespace std" and risk about as many ambiguities as if
the library stayed in the global namespace. Where's the savings?
So it's the
same difference, and it's an adequate way to explain the namespace std
system to a newbie.
It's *not* the same (see above), and while it's a convenient
bedtime story for the kids, it's about as real as Santa Claus.
That's not mix-and-match.
No it isn't. I should have used the example, "I've included <iostream.h>
and <string>, so why is my program failing to compile (or link)
properly?" I've seen three references to <iostream.h> in newsgroup
questions just this past week, along with about as many missing
std:: problems.
I tried to say "import them from their namespace".
Okay, but even if you import names one at a time from namespace
std, you still run the risk of colliding with names undreamed
of fifteen years ago. Not a big savings.
P.J. Plauger
Dinkumware, Ltd.
http://www.dinkumware.com