ReactiveX / RxJava

RxJava – Reactive Extensions for the JVM – a library for composing asynchronous and event-based programs using observable sequences for the Java VM.
Apache License 2.0
47.91k stars 7.61k forks source link

2.x Flow without message #4879

Closed Shusek closed 7 years ago

Shusek commented 7 years ago

Sometimes we don’t care about about value in stream but only information about flow (Next, Complete). The most evident case is when we use RX in UI, we can create stream of data inside view but what this Observable should emit after click? Probably at this moment the most accurate answer is View but rather i never do not want to access to my View in my stream. For example in RxJava 1 we have in stream object Void with could be very misleading and it looks rather strange when we always mapping nothing to something or subscribe to null values.

myCustomView.clicks()
.subscribe(new Action1<Void>() {
                    @Override
                    public void call(Void aVoid) {
                    }
                });

In RxJava 2 we can do workaround and send dummy static non null object like new Object() or forward our view. Both of these solutions require a rethinking.

Probable reference to JakeWharton/RxBinding#281

JakeWharton commented 7 years ago

Is there a question here? A marker object is the recommended pattern for 2.x.

Shusek commented 7 years ago

Nope, this is rather discussion about it. I was thinking about something similar to Completable with proper methods. Currently in this case most of operator like filter, distinct, groupBy etc. are useless.

akarnokd commented 7 years ago

Sorry, there won't be another reactive type in this project.

Shusek commented 7 years ago

Okay, thanks for the quick response.