Inline namespaces do not permit per-symbol migration from ABI version vX to vY. Inline namespaces cannot be (re)declared inline in one context and non-inline in another context. This means future source-breaking-but-binary-compatible upgrades would require transitioning the entire inline ABI namespace from vX to vY, even if only a small selection of entities may motivate the upgrade.
To allow for incremental source-breaking-but-binary-compatible upgrades on a per-symbol basis (e.g. upgrading bsoncxx::foo from bsoncxx::vX::foo to bsoncxx::vY::foo), remove inline from the v_noabi namespace and instead use using-declarations to declare entities in the root library namespaces.
Current:
namespace bsoncxx { inline namespace vX { void foo(); // bsoncxx::foo CANNOT be upgraded to vY... void bar(); // ... without forcibly upgrading bsoncxx::bar. } // namespace vX } // namespace bsoncxx namespace bsoncxx { namespace vY { void foo(); // A newer ABI-incompatible interface. } // namespace vY } // namespace bsoncxx
Proposed:
namespace bsoncxx { namespace vX { void foo(); void bar(); } // namespace vX } // namespace bsoncxx namespace bsoncxx { namespace vY { void foo(); // A newer ABI-incompatible interface. } // namespace vY } // namespace bsoncxx namespace bsoncxx { using bsoncxx::vY::foo; // bsoncxx::foo CAN be upgraded to vX... using bsoncxx::vX::bar; // ... without forcibly upgrading bsoncxx::bar. } // namespace bsoncxx
Changing inline namespace v_noabi into namespace v_noabi + using-declarations is a source-and-binary-compatible refactor and should not require an API major version bump.
- is depended on by
-
CXX-2745 Move interfaces into the ABI-stable namespace
- In Progress