On Wed, May 1, 2024 at 11:30 AM René Ferdinand Rivera Morell < grafikrobot@gmail.com> 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