Guidelines to implement Boost library evolution policy (was Boost 2.0)
The Boost Steering Committee set the overall policy for Boost library evolution to C++11, C++14, and beyond at its May 2014 meeting in Aspen. This wiki page is the current draft of guidelines to implement that policy.
The C++ standards committee is releasing new or revised language and library features on a regular basis. See https://isocpp.org/std/status.
Compiler and standard library implementers are adding support for new language and library features piecemeal, each in a different sequence.
So as seen by Boost developers and other users, C++ is a continuously moving target. That's very good for C++; it means the language, standard library, and their implementations are evolving rapidly to meet today's changing needs. To thrive in this continuously evolving environment, Boost libraries need to evolve continuously. In other words, the idea of a C++11 based Boost 2.0 makes limited sense; it would start to become obsolete the moment it shipped. Boost also recognizes that users will not migrate to new compiler and Standard Library releases at the same rate, and that some prefer that Boost support older compilers for an extended period.
In summary, Boost's policy is to encourage "continuous evolution" of Boost libraries.
The following guidelines for Boost library developers and maintainers implement that policy.
Existing Boost libraries
- If a new C++ feature can be conditionally added (via #ifdef or a macro such as BOOST_NOEXCEPT), libraries may do so as soon as any implementation being regression tested supplies the feature. The more useful the feature is to the Boost library's users, the more strongly the library maintainer is encouraged to start conditionally using the feature.
- If a new C++ feature cannot be added conditionally (for example, because it would cause breaking interface changes), maintainers may add a new version of the library that uses the new feature unconditionally, while continuing to support the old version. Maintainers may choose to seek a replacement maintainer for the old version of the library, of course. Because two versions of a library are painful to maintain and confusing to users, this approach is only encouraged when the advantages of using the new C++ feature would be of great benefit to library users. This is appropriate only when there is regression test coverage, for at least one implementation, of the new feature.
- Once a C++ feature has been shipping by all major C++ implementers for several releases, Boost libraries may use the feature unconditionally and stop supporting older versions that do not provide the feature. The maintainer of each Boost library must weigh the pros and cons of dropping support for older compilers and standard libraries, and consult users to gauge the impact of such a change.
Example: As of mid-2014, major compilers such as Clang, GCC, and Visual C++ have supported auto, decltype, nullptr, doubled right angle brackets, long long, rvalue references, static assert, and built-in type traits for at least three major releases, so these C++11 features are among the first a Boost library might consider using unconditionally. If conditional support, or two library versions, does not cause an unwanted burden, maintainers are free to continue that approach into the future.
New Boost libraries
- Authors of new libraries are encouraged to use the approaches described above to support platforms that do not support new C++ features. However, it is ultimately the decision of the library developer which versions of C++ to support and how.
- New libraries will not be rejected because they lack support for older platforms, particularly if new language or library features are integral to the library interface or design. An example would be a library that cannot provide a usable interface without use of a new C++ feature.
- Boost encourages the development of new, state-of-the-art libraries. The intent is to encourage innovative user interfaces and overall library designs, and if that means requiring compiler or standard library support for new C++ features, that is acceptable.
This case study from Jeff Garland illustrates why many Boost libraries leave old compiler and standard library workarounds in place as long as they don't impede library evolution:
After three years of effort my project had finally put all (~1M sloc) of 1996 pre-standard legacy C++ to bed and started compiling most of our code in C++11 this year. In large part, Boost was the tool that made that possible. Because of Boost we were able to gradually move toward what would become the C++11 standard while hacking Boost code to work with our non-compliant compiler/std library…so that when we finally ported to g++4.8 and turned on C++11 it was just a handful of changes we had to make. And now we’re successfully mixing plenty of C++11 with C++98 code in production use.