Discussion: Have an enum for Device Identifiers #37
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.
Hi there,
this Pull Request is (at least initially) intended as a discussion point. I have no big feelings that you will eventually merge this.
What is it?
A small change, introducing an enum for the device identifiers:
This enum is used in the Enumerate-Callback instead of an integer. It should also be used in
GetIdentity
, however this involves more changes to the generators and I would only do this if you think its worth it.Why?
Thread 1
Thread 2
Thread 3
Second thread is for C, but it also shows the explorability issues associated with that. Having a DeviceIdentifier adds some benefits:
DeviceIdentifier
tells you there is a type you can look up,int
tells you nothing, you have to guess)Why only C#?
In my opinion this should be included in all language-bindings that feature type-safety and where enums are usual. Best example is Java.
However for the discussion one example is enough.
Why not Merge?
I think you already realized why you might not want to merge that: Backwards-compatibility.
Merging this request would break current implementations of enumerate-callbacks, because they now have an
DeviceIdentifier
-parameter instead of anint
-param. However, it would clearly not impact the hardware-compatibility.I might have proposed this exact change earlier, but back then I did not dive into the code deep enough.
What do you think of this proposal?