Boost logo

Boost :

From: Bill Wade (bill.wade_at_[hidden])
Date: 1999-12-21 11:26:24


> From: Herb Sutter [mailto:hsutter_at_[hidden]]

> 1. Be able to add, remove, and change existing components and
> facilities from
> one version of the library to another.
>
> a) Add: Pretty easy.

In general this is true. Unfortunately almost any library feature you add
in C++ at namespace scope has the potential to introduce a silent change.
Overloading and scope resolution rules make this almost unavoidable, unless
the new name is reserved (for instance __std2000). User macros make this
problem even worse.

Even adding names to std:: can silently break user code:

// User code, in foo.h
  class foo{ ... };
  namespace std { template<> class vector<foo,myallocator>{ ... }; }

// New standard code in <iostream>
  namespace std { class foo {}; }

It becomes likely (almost certain) that the ODR is violated for vector<foo>.
Even if it isn't violated, the user may not be getting what he expects.

> This is meant to encourage discussion, not exhaustively list
> options. If BOOST
> is indeed active in part to establish existing practice, this is
> an important
> area where existing practice would be useful in the very short
> term, i.e., the
> next few months before the Tokyo meeting in April by which time some other
> people and I are hoping to have a tentative answer for this in
> the form of an
> initial draft of a paper we can work to refine while we're together.

Some general preferences:

My gut feeling is that standard stuff (including new stuff) go into std::.
This is a little less safe than using a new namespace (see my example
above). It will also step on some toes, since it is likely that a standard
std::hash_map will behave differently than some vendor's current
std::hash_map.

If you are going to use a namespace, consider nesting it within std::. Also
consider reserving some names for standard namespaces (for instance any
top-level namespace begining with std[0-9]).

I'm also inclined to believe that if you're changing the meaning of an
existing name, you should change its name, not just its namespace. If we
all decide to start using O(N) sorts, I don't expect a developer 15 years
down the road to remember that the third argument of std::sort is a
comparison function while the third argument of std200x::sort extracts
value-information for a bucket sort. It would, IMO be much better to name
the new function bucket_sort, no matter what namespace it goes into.

Finally I don't believe boost needs to be nearly as "stable" as the standard
library. I would hope that boost changes several times a year, and I'm not
bothered too much when some of those changes aren't backward compatible.
The standard library will not have significant changes more than once a
decade, and almost all of those should preserve compatibility. The theory
is that stuff won't make it into the standard until it has survived
substantial real-world abuse. The bar should not be that high for boost.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk