Skip to content
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: Observable.compose naming #4464

Closed
davidmoten opened this issue Sep 2, 2016 · 6 comments
Closed

2.x: Observable.compose naming #4464

davidmoten opened this issue Sep 2, 2016 · 6 comments
Milestone

Comments

@davidmoten
Copy link
Collaborator

Observable.compose(Transformer) has always struck me as an odd combination.

I'd expect us to compose with a composer or transform with a transformer. My preference would be to use

Observable.transform(Transformer).

Anyone up for this change in 2.x?

@akarnokd
Copy link
Member

akarnokd commented Sep 2, 2016

How about inlining Transformer as Function<? super Flowable<T>, ? extends Publisher<? extends R>>?

@JakeWharton
Copy link
Contributor

JakeWharton commented Sep 2, 2016

👍 on the operator method rename.

@akarnokd You're saying only on the method parameter type? So we'd keep the public API interface for convenience but accept the more liberal version on the method?

@akarnokd
Copy link
Member

akarnokd commented Sep 2, 2016

I'm saying let's keep it as compose.

@dalewking
Copy link
Contributor

On the subject of compose and the use of Function as its parameter type, this is kind of problematic in the real world. It would be very nice to be able to create an object that can be used to transform Observables, Flowables, Singles, Completables, and now Maybes. In other words, to have a single object instance that can be passed to any of the compose methods (Observable.compose and Single.compose and so on).

This however cannot be done because it would require having an object that extended from Function multiple times with different type arguments. (See this discussion on how it affects the RxLifecycle library and how we worked around the issue trello-archive/RxLifecycle#39).

It would be really nice if RxJava 2 could address this some how. Perhaps it would require having two versions of the compose method. One that takes the more generic Function type as a parameter and another one that takes a type specific interface that does not implement Function.

@akarnokd
Copy link
Member

Naming it transform feels odd to me, mostly because Guava's FluentIterable called its map as transform. If you want to change the functional interface to be unique then go ahead with a PR.

@akarnokd
Copy link
Member

I'm closing this issue due to inactivity. If you have further input on the issue, don't hesitate to reopen this issue or post a new one.

@akarnokd akarnokd added this to the 2.0 milestone Oct 25, 2016
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

4 participants