Also how stable is RxKotlin & how wide spread ...
# rx
t
Also how stable is RxKotlin & how wide spread is it?
g
RxKotlin is just a bunch of extension functions for RxJava and mostly to fix problems with type inference
t
Great summary, thanks
g
But RxKotlin is definitely useful and I would recommend to use it for Kotlin projects
👍 2
u
@gildor is it going to be obsolete with new type inference?
g
I didn’t try new inference, but yeah, probably it will solve many existing problems and some RxKotlin functions will be obsolete, but there are many handy Kotlin extensions that not related directly to type inference problems
a
@ursus new type inference doesn’t solve all the problems unfortunately 😞 For example:
After you apply the intention:
g
I’m curious is this case reported?
a
I tried this just moments ago, so I’m not aware
g
@arekolek I checked this case again and looks that this is not an issue of inference
👍 1
see, both onErrorResumeNext overloads are ambiguous, both of them cannot be differentiated by return type in this case
ObservableSource
argument is
Observer
and return value is
Unit
Function
argument is
Throwable
and return value is
ObservableSource
So syntax
.onErrorResumeNext { Observable.just(2) }
works for both of them
You will have the same with pure Kotlin functions:
Copy code
fun foo(l: (String) -> Unit) {}

    fun foo(l: (Int) -> String) {}
    
    foo {} // Overload resolution ambiguity
a
I guess you are right, I never checked this prior to now, but Java has the same problem in this case.
g
It’s actually more interesting problem, because also generics erasure involved, so Kotlin example is not so simple, both functions have the same type on runtime, but it’s not true for SAM types
But at least function such as
zipWith
work properly with new type inference, so RxJava2 API now much more useful from Kotlin without RxKotlin
👍 1
u
new type inference is not yet in 1.3 right?
a
It’s experimental, so you can opt-in to enable it, in `app/build.gradle`:
Copy code
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
    kotlinOptions {
        freeCompilerArgs = ["-XXLanguage:+NewInference"]
    }
}