Boost logo

Boost :

From: John Maddock (jz.maddock_at_[hidden])
Date: 2024-12-17 14:17:39


On 17/12/2024 02:37, Chuanqi Xu via Boost wrote:
> Hi Boost Developers,
> I am Chuanqi Xu, the maintainer for modules & serialization in clang and also a fan of C++20 modules. The post itself was motivated by a discussion (https://cpplang.slack.com/archives/C27KZLB0X/p1734335425348809 <https://cpplang.slack.com/archives/C27KZLB0X/p1734335425348809 >). You don’t need to read it if you’re not interested. I’ll try to make the post itself self contained.

I *think* at present I would prefer to see library-level support - ie
clients would do a:

import boost.whatever;

rather than a single monolithic:

import boost;

In any case multiple libraries can be always be grouped together in a
"super-module" that import-exports all of them.

There are some advantages to this:

* it's modular and can grow gradually based on demand.

* We don't get blocked by if library X explodes all current compilers
(there's some complex code in Boost after all).

FYI regex currently has an experimental branch which does this - I
really should have got it into the last release, basically I just need
to document things.

I would also add that it's not really as straightforward as you might
think - compilers are certainly getting better in this regard - but
there are all sorts of traps especially if client code mixes imports
with #includes of regex's std lib dependencies.  I also had to do quite
a bit of work (real code changes) to ensure that module builds were
actually faster in practice than a simple header-only approach.  Given
the template-heavy nature of Boost I would imagine that many libraries
would be in this situation.  And finally.... build systems *currently*
are not up to the job.... if I merged the regex module support now that
would leave users with a very 1980's "here's some code files, build them
yourself" kind of situation.

Best, John.


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