18096, "e-kayrakli", "How should we have different implementations of data structures with similar interfaces?", "2021-07-22T23:22:54Z"
Take list
, for example. We have vector
, unrolledLinkedList
and linkedList
at different locations in our repo all with similar interfaces (or at least they all want to have a similar interface as list
).
Q1: Should we have different implementations of similar data structres in the standard libraries to provide a wider range of choice when it comes to complexities?
If so,
Q2: What does the general module structure look like:
- A generic type that has default implementation, but the users can swap different implementations to get different performance behavior using a param field.
- It's a burden for the maintainer of the type as new implementations needs to be added to the main type's implementation.
- Different implementations might have slightly different interfaces
- Entirely separate types implementing different data structures. Potentially all
implement
ing the sameinterface
(s).
- Are we openning doors for having 20 different data structures to maintain in the standard libraries? (Is it a bad thing?)