Aligning with UTransport::register_listener() and UTransport::unregister_listener() with UListener#67
Closed
PLeVasseur wants to merge 4 commits intoeclipse-uprotocol:mainfrom
Closed
Conversation
Contributor
|
Hm - we explicitly removed the UListener trait approach in favour of a simple listener ID, back in the good old days (round of reviews for the initial PR). So on this question, I'd look at @sophokles73 for informed opinions, for now. |
Contributor
Author
|
Closing in favor of #68 which resolves all of the issues I had with this approach. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Hey there 👋
Based on #65, I took my shot at aligning our
UTransporttrait closer to the spec.In particular, I have removed the requirement for the implementation to explicitly manage listeners using
Stringidentifiers, instead leaning on concrete implementations of theUListenertrait.This change is to align with
registerListener()andunregisterListener()by bringing in aUListenertrait.As you read the code, you can definitely see there were compromises that had to be made to accomplish this.
Let me list the ways:
UListenermust have another functionas_any()which must be implemented by the concrete impls of it to always returnselfUListenercould be tweaked to remove this requirement!unregister_listener(), we must instantiate anotherBox<dyn UListener>from the concrete type to do soIn addition, it does make it quite a bit more annoying because instead of being able to pass in any boxed function anywhere that meets the signature, you must now first implement UListener for each and every different function that you wish to be able to register with
UTransport. This is not a small change and pretty annoying in my opinion.I'm looking to see how this would impact current and future implementations of
UTransportfor UPClients. Feedback would be great from @AnotherDaniel, @sophokles73, @evshary in particular 🙂