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

Do these methods really belong in RxKotlin? #58

Closed
maxandron opened this issue Mar 22, 2016 · 8 comments
Closed

Do these methods really belong in RxKotlin? #58

maxandron opened this issue Mar 22, 2016 · 8 comments

Comments

@maxandron
Copy link

Hi,

Just wondering about the reasoning behind adding functions such as deferredObservable, observable or emptyObservable.
They do not add anything kotlin specific.

They might help with readability, but do they really belong in RxKotlin?

Or am I missing something?

Thanks

@cy6erGn0m
Copy link
Contributor

They might help with readability

This is why they are here. Almost everything here is just to make code look better.

@maxandron
Copy link
Author

I see, thanks.
I thought this library was adding kotlin specific readability helpers. These three methods could just as well be in the original RxJava api.

@JakeWharton
Copy link
Member

deferredObservable

You can already use defer { .. } with import rx.Observable.defer so 👍 to removing this.

emptyObservable

You can use empty() with import rx.Observable.empty so 👍 to removing this.

observable

This just seem superfluous. Almost no one should be using create anyway. just, defer, fromCallable and fromAsync are all better choices that will prevent you from shooting yourself in the foot. 👍 to removing this.

@ultimate-deej
Copy link
Contributor

ultimate-deej commented Sep 6, 2016

I believe these functions are here to to comply with standard Kotlin functions like emptyArray, emptyMap etc.
So they do add something kotlin specific, at least emptyObservable.
empty

@thomasnield
Copy link
Collaborator

I agree with @JakeWharton here. Pretty much any function that is not an extension function should be removed. These resemble more syntactic saccharine than syntactic sugar. They offer minimal readability benefit and makes moving from RxJava to RxKotlin more convoluted, and many will keep using the RxJava factories anyway.

Besides, if people want them that badly they can implement these functions themselves on their domain with little effort, to the point it is not even worth creating a library for. That's the great thing about Kotlin. You can create your own DSL for your needs.

@stepango would you like me to put in a PR removing all these functions?

@stepango
Copy link
Collaborator

stepango commented Jan 5, 2017

@thomasnield I'll prefer to deprecate it first and remove it in one of the future releases

@thomasnield
Copy link
Collaborator

Sounds good.

@stepango
Copy link
Collaborator

stepango commented Mar 4, 2017

Agreed with @JakeWharton, @maxandron and @thomasnield. This functions will be removed in upcoming 1.x and 2.x along with some others. Feel free to reopen this issue for further discussion.

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

No branches or pull requests

6 participants