-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
2.x design decisions #3782
2.x design decisions #3782
Conversation
class Flowable<T> implements Flow.Publisher<T>, io.reactivestreams.Publisher<T> { | ||
void subscribe(Subscriber<T> subscriber); | ||
|
||
interface Subscriber<T> implements Flow.Subscriber<T>, io.reactivestreams.Subscriber<T> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extending both will prevent direct use of any instance of them directly.
Besides, the signature doesn't compile because it requires
void subscribe(io.reactivestreams.Subscriber)
void subscribe(java.util.concurrent.Flow.Subscriber)
to be implemented separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now we are not targeting Flow.Subscriber
since this planned for Java 1.9. Our current source code compatibility is 1.6. I believe the rationale was to show that we intend that this would one day extend and interoperate with Flow
.
This line should just be changed to ...
interface Subscriber<T> extends io.reactivestreams.Subscriber<T> {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
an io.reactivex.Subscriber
will just name-conflict with io.reactivestreams.Subscriber
without any benefit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So your proposal is to just remove this interface?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point if we don't need a concrete implementation (which we don't).
General observationsClass structureI didn't see any mention of the architecture of the base objects and how one adds operators to it. As I suggested in my design retrospect post, we can save a lot of allocations by extending the base class instead of using create/lift internally all the time. Error handlingIn addition, I don't see any mention of requiring operators to call Consequently, since RS subscribers shoudn't really throw in their Default Subscriber implementationsSince cancelling and disposing is now potentially racy, we can't really expect end-subscribers to implement logic for them in their Operator fusionMacro-fusion relies on the property that operator classes can be identified in some way. For example, Micro-fusion requires a library-internal protocol to work amongst operators. One day, it would be great to have standard fusion protocol library that all RS libraries can implement and do cross-library fusion with it. Changes to 2.x masterI see the following changes required in current 2.x master:
|
It still up to discussion to know how we will generate multiple targets? | ||
Options are: | ||
|
||
- two artifcat ids: rxjava-jdk6, rxjava-jdk8 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What advantage is there for producing two artifacts? If you're not using JDK 8 APIs why not just make the JDK 6 artifact the canonical one.
Having two makes me very nervous about binary compatibility with the two. Java projects built against the JDK 6 impl which aim to support Android should be binary compatible with JVM users on Java 8+. Either a mechanism should be put in place to verify binary compatibility (e.g., animal sniffer) or it might just be easier to have only a single output artifact.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, how would you include sources for the jdk6 distribution since retrolambda only operates on the bytecode? It would make the IDE have to decompile the classes to represent them rather than being able to just click in. Would this not make debugging unnecessarily more tedious and also sacrifice javadoc/comment access?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a great point. We of course do not want to cause unnecessary friction in any subset of user base. The bytecode compatibility can easily be tested as per the proposals in #3764 (see comment).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer having a single artifact.
These sound like additive changes to the existing design revision. Would it be okay if you make a revision to the DESIGN.md document and open a PR with proposals to address these items?
Can you hold off on opening PRs until the DESIGN.md changes have been merged into 2.x? This should serve as a sign that the decisions have been reviewed and commitment has been reached by the RxJava committers. You are of course welcome to play around with code for your own understanding and demonstration purposes. |
Sure. Can you hold off on opening PRs until the DESIGN.md changes have been merged into 2.x? Yep. |
I suggest merging this document so we can start modifying portions of it via PRs. There appear to be no general disputes, but valid changes to individual items that should be done. |
It's been a week. Can we merge? |
Fine, 👍, let's use it as a starting point. |
Merged. Let's start making changes via small pull requests on the various details that were discussed above. |
It's unfortunately been a month and nothing new has been contributed to the 2.x branch. Netflix folks, @akarnokd, and others: would it be useful create a slack group for reactivex/RxJava to facilitate discussions amongst each other and the community rather than strictly GitHub correspondence? It seems like the latter is adding unnecessary friction to discussions since it doesn't scale well to many people discussing at once, let alone its inherent slowness conpared to chat. Could help improve organization and planning amongst contributors as well. Would be happy to help organize this, and I know many other developers have wished there was a resource like it having similar ones for other platforms and frameworks. |
My latest refactor PR is still not merged so I can't really start pushing other things. If you want, you can set up a chat somewhere, but note I'm at GMT+2. |
This is a first draft of the design document for the 2.x branch.
We are interested in collecting any feedback from the community (implementers but also pure users).
This present document is the collaborative work of @abersnaze, @benjchristensen, @stealthcode, and @stevegury. But we encourage anyone to propose improvements/clarifications via pull-request.