-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
art_insert() should return a return code #19
Comments
@kellabyte Yep, that was definitely an API mistake. In retrospect, it should have returned the old value via an inout argument and returned an int status code, but ship has sailed... If you call |
Ship has sailed? The API is frozen forever? I might have to second guess using this library if improvements are frozen for good like that. |
@kellabyte there is downstream code that would break if the function signature is changed, and I prefer to maintain backwards compatibility where possible. Another variant of art_insert could have a different type signature however. |
Feels like to me you're lacking a release process. If you want to pin a piece of software to this API version create a branch with a version name and pin your down stream software to that release while you move |
@kellabyte that is fair. This project has effectively had a single release so I haven't invested time building a release project. It's not my intention to be difficult, but I don't have the time to maintain this full time. If you find it useful as is that's great, otherwise I hope you can either learn from it or fork and adapt it to your use case. |
This is the current definition of
art_insert()
:This is a really odd C return pattern. I don't like the idea that this could never fail. I'm sure there are some failure conditions and should return a return code. This function should tell me in the return code if something failed or if a key already exists.
Alternatively there could be a
art_get_or_insert()
function with avoid**
return argument for times you want to insert if it doesn't exist.Also, why is there no
set()
function? What if I want to overwrite a value?The text was updated successfully, but these errors were encountered: