Skip to content

2.x: reduce number of operator overloads #4153

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

Closed
akarnokd opened this issue Jun 30, 2016 · 4 comments
Closed

2.x: reduce number of operator overloads #4153

akarnokd opened this issue Jun 30, 2016 · 4 comments
Milestone

Comments

@akarnokd
Copy link
Member

RxJava has several hundred methods in Flowable and Observable each, many of them overloads of the same operator with different parameters because Java doesn't support default parameter values or that using methods with varargs is inconvenient at times.

To reduce the numbers, I suggest the following removals:

  • multi-source operators that take 7-9 sources, such as concat(p1, p2, p3, p4, p5, p6, p7, p8) and zip(p1, p2, p3, p4, p5, p6, p7, Function7)
  • operators that have multiple configuration options would only have 2 overloads, one with reasonable defaults and another with all parameters to be specified; example observeOn(Scheduler) and observeOn(Scheduler, delayError, prefetch), flatMap(mapper) and flatMap(mapper, maxConcurrency, delayError, prefetch)

For this latter, the documentation has to be enhanced to give examples of what defaults to use.

@LalitMaganti
Copy link
Contributor

I have another suggestion: source generate the missing overloads (using a Gradle plugin for example) so that we keep the class in the repository small but the actual included class has all available overloads.

This I feel is a good compromise between the Observable/Flowable classes being readable as well as giving the benefits of the extra overloads to the user.

@JakeWharton
Copy link
Contributor

I'm not sure management of the overloads has ever itself been a problem. If
they're going to end up in the jar anyway then it's not that big of a deal
to keep them in the source.

On Thu, Jun 30, 2016 at 2:00 PM Lalit Maganti [email protected]
wrote:

I have another suggestion: source generate the missing overloads (using a
Gradle plugin for example) so that we keep the class in the repository
small but the actual included class has all available overloads.

This I feel is a good compromise between the Observable/Flowable classes
being readable as well as giving the benefits of the extra overloads to the
user.


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
#4153 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AAEEEQUQapzHUhymJYZiTu5o5nFvBUH_ks5qRAQzgaJpZM4JCRTc
.

@akarnokd
Copy link
Member Author

The aim is to reduce the method count, mostly for Android's sake but also for the IDEs.

@akarnokd
Copy link
Member Author

Closing via #4413.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants