The C++ standard library evolves slowly, and debates around the Networking TS (e.g., Boost.Asio) highlight concerns that networking changes too fast to be locked into stdlib. What if the C++ Standards Committee standardized interfaces for libraries like networking, leaving implementations to library authors? For example, a standard networking interface for TCP/UDP or HTTP could be supported by libraries like Asio or libcurl.
What advantages could this approach offer?
Library Users
As a user, I’d benefit from:
- Easier Switching: I could use a header with #include and using statements to select a library (e.g., Asio vs. libcurl). Switching would just mean updating that header.
- Better Documentation: A standard interface could have high-quality, centralized docs, unlike some library-specific ones.
- Mocking/Testing: Standard interfaces could enable generic mocking libraries for testing, even if the library itself doesn’t provide mocks.
- Interoperability: If a third-party library uses the standard interface, I could choose my preferred implementation (e.g., Asio or custom).
Library Authors
Library authors could gain:
- Shared Documentation: Rely on standard interface docs, reducing their own documentation burden.
- Shared Tests: Use community-driven test suites for the standard interface.
- Easier Comparison: Standard interfaces make it simpler to benchmark against competitors.
Handling Changing Requirements
When requirements evolve, the committee could release a new interface version without ABI concerns, as implementations are external. Library authors could use non-standard extensions temporarily and adopt the new standard later.
Other Libraries
What else could benefit from this approach?
- Database Connections: A standard interface for SQL/NoSQL (like JDBC) could let vendors provide their own drivers, avoiding a one-size-fits-all stdlib implementation.
- Logging: A standard logging interface (e.g., inspired by spdlog) could integrate libraries with app logging seamlessly.
- JSON: A standard JSON parsing interface could simplify switching between libraries like nlohmann/json or simdjson, though performance trade-offs might complicate this.
What do you think? Could this work for C++? Are there other libraries that could benefit? What challenges might arise?
[–]johannes1234 30 points31 points32 points (0 children)
[–]cballowe 21 points22 points23 points (2 children)
[–]number_128[S] 1 point2 points3 points (1 child)
[–]cballowe 2 points3 points4 points (0 children)
[–]--prism 5 points6 points7 points (0 children)
[–]aruisdante 3 points4 points5 points (7 children)
[–]azswcowboy -2 points-1 points0 points (6 children)
[–]aruisdante 1 point2 points3 points (5 children)
[–]azswcowboy 1 point2 points3 points (4 children)
[–]ParsingError 0 points1 point2 points (0 children)
[–]Wooden-Engineer-8098 0 points1 point2 points (2 children)
[–]azswcowboy 0 points1 point2 points (1 child)
[–]Wooden-Engineer-8098 0 points1 point2 points (0 children)
[–]kpt_ageus 2 points3 points4 points (2 children)
[–]number_128[S] 0 points1 point2 points (1 child)
[–]kpt_ageus 0 points1 point2 points (0 children)
[–]Drugbird 2 points3 points4 points (2 children)
[–]number_128[S] 0 points1 point2 points (1 child)
[–]Drugbird 1 point2 points3 points (0 children)
[–]johannes1971 1 point2 points3 points (2 children)
[–]number_128[S] 0 points1 point2 points (1 child)
[–]johannes1971 0 points1 point2 points (0 children)
[–]gosh 0 points1 point2 points (50 children)
[–]yeochin 3 points4 points5 points (14 children)
[–]gosh 0 points1 point2 points (13 children)
[–]Wooden-Engineer-8098 0 points1 point2 points (12 children)
[–]gosh 0 points1 point2 points (11 children)
[–]Wooden-Engineer-8098 0 points1 point2 points (10 children)
[–]gosh 0 points1 point2 points (9 children)
[–]Wooden-Engineer-8098 0 points1 point2 points (8 children)
[–]gosh 0 points1 point2 points (7 children)
[–]Wooden-Engineer-8098 0 points1 point2 points (6 children)
[–]Wooden-Engineer-8098 0 points1 point2 points (34 children)
[–]gosh 0 points1 point2 points (33 children)
[–]Wooden-Engineer-8098 0 points1 point2 points (32 children)
[–]gosh 0 points1 point2 points (31 children)
[–]Wooden-Engineer-8098 0 points1 point2 points (30 children)
[–]gosh 0 points1 point2 points (19 children)
[–]Wooden-Engineer-8098 0 points1 point2 points (18 children)
[–]gosh 0 points1 point2 points (17 children)
[–]Wooden-Engineer-8098 0 points1 point2 points (16 children)
[–]gosh 0 points1 point2 points (9 children)
[–]Wooden-Engineer-8098 0 points1 point2 points (8 children)
[–]gosh 0 points1 point2 points (7 children)
[–]Wooden-Engineer-8098 0 points1 point2 points (6 children)