webrtc icon indicating copy to clipboard operation
webrtc copied to clipboard

Unknown constant collides

Open wdouglass opened this issue 5 years ago • 6 comments

The Unknown constant in constants.go is set with iota, which in it's block always resolves to 0. This collides in a lot of places; This issue is a discussion point.

should we set "Unknown" to an arbitrary value? should we start all of our enumerations at iota+1? not sure how to resolve this, but it may be the source of a few bugs!

wdouglass avatar Jul 01 '20 12:07 wdouglass

I'm happy to refactor to resolve this, but let's discuss a solution first.

wdouglass avatar Jul 01 '20 12:07 wdouglass

Hey @wdouglass

Sorry I never responded to this. I am just starting to catch up on things for v3.1.0. I think we should remove Unknown entirely. This does seem like a major source of bugs!

Instead for every enum we should have a dedicated Unknown like RTPTransceiverDirectionUnknown

I am also in support of requiring iota + 1, but that seems like people could make mistakes.

Sean-Der avatar Aug 06 '21 16:08 Sean-Der

Hey @wdouglass

Sorry I never responded to this. I am just starting to catch up on things for v3.1.0. I think we should remove Unknown entirely. This does seem like a major source of bugs!

Instead for every enum we should have a dedicated Unknown like RTPTransceiverDirectionUnknown

I am also in support of requiring iota + 1, but that seems like people could make mistakes.

I think that's a great solution! thanks!

wdouglass avatar Aug 06 '21 16:08 wdouglass

@wdouglass you are fast :)

You interested in taking that on? Happy to merge a PR right away, would love to have you back!

Sean-Der avatar Aug 06 '21 16:08 Sean-Der

yeah, i could try to put a patch together later today

wdouglass avatar Aug 06 '21 16:08 wdouglass

Moving to v4.0.0 this would be an API break unfortunately

Sean-Der avatar Aug 22 '21 00:08 Sean-Der