Hello,
I'm used to RxJava 2 and now trying to use RxSwift, but I notice few differences and wanted to know if some are on purpose or just missing stuff.
Completable.complete on java against Completable.empty in swift (for me make more sens complete)asCompletable methodMaybe there more I'll find out with time ^^
:warning: Fields below are optional for general issues or in case those questions aren't related to your issue, but filling them out will increase the chances of getting your issue resolved. :warning:
Installation method:
I have multiple versions of Xcode installed:
(so we can know if this is a potential cause of your issue)
Level of RxSwift knowledge:
(this is so we can understand your level of knowledge
and formulate the response in an appropriate manner)
Some more ^^
flatMapObservable to be able from a Single/Maybe/Completable to switch to an observable and the opposite flatMapSingle/flatMapMaybe/flatMapCompletable from an Observable
onErrorResumeNext and onErrorReturn are also missing for PrimitiveSequence
onErrorResumeNext missing from Observable
Hi @jaumard ,
We can think about how can we reduce the gap, but I don't think we will match RxJava perfectly, since RxJava also doesn't perfectly match other Rx implementations.
Some of these differences are language differences, some are caused accidentally by different development teams, some are improvements.
We would need to separate each of them and fix the accidental differences which are named better in RxJava.
Completable.complete on java against Completable.empty in swift (for me make more sens complete)
RxJava considers Single, Maybe and Completable as different entities and not a constrained observable sequence. It seems to me that both views are equally valid.
Single/Maybe should have asCompletable method
The reason why we haven't added every possible method is because we wanted to make as orthogonal methods as possible. asCompletable() =asObservable().ignoreElements()`.
onErrorReturn in java against catchErrorJustReturn in swift
I believe RxJava.onErrorReturnItem = RxSwift.catchErrorJustReturn. I don't think our naming is perfect, but I don't think RxJava naming is perfect either.
Naming operators should represent high level operations/concepts IMHO. Using onError in operator name implies a low level event handler (onError), and not high level operation that is being performed (catching and error/exception).
Here are some examples to illustrate my point. It's / vs:
Observable.error and not Observable.onErrorObservable.never and not Observable.dontSendAnyEventObservable.just and not Observable.onNextAndCompleteFor some reason RxJava uses the item nomenclature vs element.
https://en.wikipedia.org/wiki/Sequence
In mathematics, a sequence is an enumerated collection of objects in which repetitions are allowed. Like a set, it contains members (also called elements, or terms).
The reason why we've finished with JustReturn is to imply that we are returning a new sequence that contains of just one element (you can also read it as using just operator transparently).
I guess we could have added an operator RxSwift.catchErrorReturn(_ other: Observable<Element>), so RxSwift.catchErrorJustReturn(_ other: Element) would be just a convenience, but I don't think RxSwift.catchErrorReturn(_ other: Observable<Element>) would be used often.
There is a lot Rx implementations out there, so when discussing naming, it would be great to include other ones also, at least RxJs.
Most helpful comment
Hi @jaumard ,
We can think about how can we reduce the gap, but I don't think we will match RxJava perfectly, since RxJava also doesn't perfectly match other Rx implementations.
Some of these differences are language differences, some are caused accidentally by different development teams, some are improvements.
We would need to separate each of them and fix the accidental differences which are named better in RxJava.
RxJava considers Single, Maybe and Completable as different entities and not a constrained observable sequence. It seems to me that both views are equally valid.
The reason why we haven't added every possible method is because we wanted to make as orthogonal methods as possible.
asCompletable() =asObservable().ignoreElements()`.I believe
RxJava.onErrorReturnItem=RxSwift.catchErrorJustReturn. I don't think our naming is perfect, but I don't think RxJava naming is perfect either.Naming operators should represent high level operations/concepts IMHO. Using
onErrorin operator name implies a low level event handler (onError), and not high level operation that is being performed (catching and error/exception).Here are some examples to illustrate my point. It's / vs:
Observable.errorand notObservable.onErrorObservable.neverand notObservable.dontSendAnyEventObservable.justand notObservable.onNextAndCompleteFor some reason RxJava uses the item nomenclature vs element.
https://en.wikipedia.org/wiki/Sequence
The reason why we've finished with
JustReturnis to imply that we are returning a new sequence that contains of just one element (you can also read it as usingjustoperator transparently).I guess we could have added an operator
RxSwift.catchErrorReturn(_ other: Observable<Element>), soRxSwift.catchErrorJustReturn(_ other: Element)would be just a convenience, but I don't thinkRxSwift.catchErrorReturn(_ other: Observable<Element>)would be used often.There is a lot Rx implementations out there, so when discussing naming, it would be great to include other ones also, at least RxJs.