|
Boost : |
From: Greg Colvin (gcolvin_at_[hidden])
Date: 1999-12-21 11:53:18
From: Bill Wade <bill.wade_at_[hidden]>
> > 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.
I believe this user's code is already broken. Users should not use std,
by fiat. For that matter, users should not use other peoples namespaces,
including boost, by custom, on penalty of having their code broken by
the owners of the namespace.
> ...
> 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.
Agreed.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk