As we develop libcyphal and as C++ Nunavut matures there is an emerging need to share some basic container types between the two projects that are either not readily available in STL or not available in STL at our base support level of C++14. As such we have three ways forward:
-
Write duplicate types for both projects and share nothing. This is a bad plan since it forces the user to convert between two thread-bare implementations or co-ordinate overrides to their preferred implementations between both projects.
-
Use Nunavut types in libcyphal directly. This seems odd and problematic since the Nunavut types don’t exist until nnvg generation has completed and for reasons discussed in the thread below…
-
Start a new OpenCyphal project: Cyphal Embedded Template Library. This would be a common dependency of all OpenCyphal C++ code but would remain a disciplined set of types that are in active use by OpenCyphal projects.
Project Tenets
- CETL does not supplant STL, ETL, boost, or any other full-featured support library. It is not a general-purpose C++ support library and is limited to the minimum set of types needed to ensure OpenCyphal C++ projects are agnostic to these larger projects.
- All OpenCyphal projects that use CETL shall allow total replacement of CETL types by providing compile-time overrides.
- CETL types should support replacement by C++17 and newer concepts. Where a popular library diverges from the C++ standard CETL will prefer the standard (e.g. if ETL’s span and the C++20 span have different interfaces or behaviors CETL will mimic C++20)
- CETL types will never require use of the default STL heap. They may require the user to specify an allocator before they can be instantiated.
To help clarify, this is how the initial set of dependencies would work:
I’m sure this list of tenets will grow as we discuss the proposal. Your feedback is requested: