Get rid of "userdata" #7
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, all methods to set client callbacks (
jack.Client.set_*_callback()) have an optionaluserdataargument. This was meant to mimic the "void* arg" argument in the JACK API, but this argument isn't actually used in the implementation. Instead, theuserdataargument is implemented by using a Python closure (callback_wrapper()), which avoids converting the value to avoid*and back.I think the argument
userdatawill probably never be used, because users of the library can just create a closure themselves and use it as callback function.The advantage of dumping
userdatawould be that the function signatures of the callback functions would become much easier to understand.Also, users wouldn't be forced to add the
userdataargument to their callback functions even if they know they will never use it, which IMHO is quite annoying.Are there any disadvantages?
I think the
userdataargument only adds confusion and nuisance and doesn't help anyone.Is there any conceivable use case which cannot be implemented without the
userdataargument?