Boost logo

Boost :

From: Vinnie Falco (vinnie.falco_at_[hidden])
Date: 2024-05-01 19:09:02


On Wed, May 1, 2024 at 11:30 AM René Ferdinand Rivera Morell <
grafikrobot_at_[hidden]> wrote:

> I think Christian meant adding a compression abstraction library above
> zlib, bz2, zip, etc?
>

That is a different question, yes, and one worth answering.

My experience integrating zlib as a header-only C++ library into beast has
also informed me about the utility of bolting a "modern API" onto an
ancient library that has a C interface. And that is, that it is not worth
it. At least not for ZLib. The current API for ZLib is about as perfect as
you can get. Fill in a struct with the input and output buffers, call a
function, and then when the function returns you are informed about the
amounts consumed from the respective buffers.

Maybe this could be wrapped up in some kind of popular C++ "stream" type
interface, or a DSL of sorts as showcased by Ranges and now
Sender/Receiver. But doing so incurs a cost: users must learn a new
interface. ZLib is already so well understood and entrenched that wrapping
it would in a single stroke make obsolete all of the blog posts, tutorials,
example code, documentation, and user experience with the current ZLib API,
forcing people to learn another New Thing. Cue xkcd regarding "15 competing
standards."

Thanks


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