-
Notifications
You must be signed in to change notification settings - Fork 123
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
keyCreate: simpler alternative to keyNew #3112
Comments
I'll just add my example for other readers: For
Generally I really like this idea! I just didn't get the difference between |
Thank you for the suggestion! I also like the idea but I need to be strict about not implementing new features as we will get lost otherwise and never finish 1.0. Having So, I will close so the issue so that we can focus more on 1.0. As it is tagged with 2.0.0 we can easily find it again once we have released 1.0.0. |
Its the same as for
Yes, the terminating
I totally agree that this is not a 1.0 issue, but since it is just an addition to the API and doesn't break anything we don't have to wait for 2.0.0 either. |
Yes, good point. If we get too many 2.0.0 issues we can separate between post1.0.0 and things which really need to wait for 2.0.0. |
Btw. every binding writer is free to introduce something like this. For python we will get it now with #3133 |
As it came up in #3151. The main reasons to not do it now (for 1.0) is:
|
The API for
keyNew
is very flexible, but its also very verbose. In addition the resulting binary code is quite big. For example creating a simple key with a string value, type and description metadata is done like this:The
keyswitch_t
arguments are not required in this simple case. But each of them represents at least 1 instruction. If a bigKeySet
is created with manykeyNew
calls (e.g. in code-generatedloadConfiguration
like in LCDproc), this can result in many instruction that are somewhat unnecessary. This is why I proposekeyCreate
andkeyVCreate
:The
...
/va_list
is just a list of 2n+1const char *
. The indices 0, 2, ..., 2n-2 are meta key names, the indices 1, 3, ..., 2n-1 are the corresponding meta key values and 2n is alwaysNULL
(n is the number of metakeys).Not only would these functions reduce the number arguments and therefore the binary size, the could would also be more readable IMO. Especially if keys are created without metakeys (e.g.
keyCreate ("/my/key", "my value", NULL)
). The functions could also be implemented more efficiently thankeyNew
.The text was updated successfully, but these errors were encountered: