-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Making Single, Completable, Maybe all inherit from Observable #4584
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
Comments
I'd like to address the disadvantages:
|
Not advocating or condemning this just yet, but just want to share some thoughts.
This is the single biggest problem I found. Thankfully I used Kotlin and could do
In my prototype I still retained individual observers. If you subscribe to a
Non-goal. Nailing the consumer API is my only concern. This also further makes the above point not true since you can still optimize operators against singles, completables, etc.
I'd be surprised if this was an actual problem in practice. Is the creation of the chain a hot path or is the execution of events down the chain the hot path? I would wager concerns of the latter outweigh the former 100x over.
Same as above. You still get all the interface benefits except there's actually a lower conversion overhead. |
When I first concieved Whatever unification you have in mind, try implementing a minimum viable "product" (in Java) and see how far the rabbit hole goes.
Kotlin has extension methods so you could build a native RS library just by targeting interfaces. I did a similar thing in Reactor-Core.NET where many operators implement |
I'd be happy to implement an MVP and see what falls out. |
Extension methods also get you invokestatic! |
I'm closing this for now. I can imagine this done in Kotlin where there are extension methods and suppression and thus less painful than in Java. |
Here's my version from a few months ago which is incomplete: I didn't use extension methods but I'll have to try. On Sat, Nov 12, 2016, 2:23 PM David Karnok notifications@github.com wrote:
|
(or alternatively make all four inherit from a common base class)
At this point in RxJava 2.0 we have four NBP classes all of which have similar semantics but are currently totally decoupled from each other. Even though @akarnokd has been doing great work keeping all the code synced across the four operators this setup is a minefield for bugs and is extremely hard to follow the changes from an external watcher perspective (I don't know how you manage to review so many changes @JakeWharton!).
My proposal is to make the class have a some base class such that effort is not duplicated across different types.
@JakeWharton from another issue:
Obviously such a drastic change has both advantages and disadvantages.
Advantages:
Disadvantages (from @akarnokd's post):
The text was updated successfully, but these errors were encountered: