When evolving APIs, prioritize backward compatibility by creating new methods or overloads rather than modifying existing function signatures. This prevents breaking changes for existing users and extensions.
When evolving APIs, prioritize backward compatibility by creating new methods or overloads rather than modifying existing function signatures. This prevents breaking changes for existing users and extensions.
Key strategies include:
duckdb_vector_slice_dictionary
instead of modifying duckdb_slice_vector
)FileHandle::Read
methods with and without QueryContext
)duckdb_malloc
so users can free with duckdb_free
, or encapsulate complex data in opaque objects with accessor methodsExample of good practice:
// Instead of modifying existing signature:
// DUCKDB_C_API void duckdb_slice_vector(duckdb_vector vector, duckdb_selection_vector selection, idx_t len);
// Add a new method:
DUCKDB_C_API void duckdb_vector_slice_dictionary(duckdb_vector vector, idx_t dict_size,
duckdb_selection_vector selection, idx_t len);
This approach ensures existing code continues to work while providing new functionality through clearly named, purpose-built interfaces.
Enter the URL of a public GitHub repository