Boost logo

Boost :

From: Vinnie Falco (vinnie.falco_at_[hidden])
Date: 2024-05-01 14:37:15


On Tue, Apr 30, 2024 at 11:14 PM Nigel Stewart via Boost <
boost_at_[hidden]> wrote:

> ...zlib, zstd, bzip2 and xv-utils all ought to be promoted to first-class
> boost libraries
>

Boost.Beast author here.

When I wrote Beast I decided to port zlib to header-only and inline the
sources directly in Beast. This made things easier for people that want a
header-only library and don't want the hassle of dealing with adjusting
their build scripts to compile and link to the zlib library.

In retrospect, this was a mistake for the following reasons:

1. The port may have defects
2. Improvements to zlib have to be ported to my version
3. The port can't be linked like a normal zlib library and thus is less
reusable

As I now have a lot of experience with both header-only and regular flavors
of libraries I am no longer enthusiastic about header-only libraries. They
make things take longer to build, they expose a lot of implementation
details in the header files, and they often indirectly cause large
executables because heavy use of templates seems to go hand in hand with
header-only.

The more sustainable solution I think is to require that users are able to
incorporate third party libraries into their build scripts. This is made
easier with package managers of course, and now there are enough solutions
that we do not need to be treating users like infants incapable of putting
together a non-trivial program.

It should be obvious that the pattern of "port linkable libraries into
header-only Boost libraries that don't require separate compilation" is
completely unsustainable, if for no other reason than - what do we do with
OpenSSL?

Thanks


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