Skip to content

Should Observable.range and Observable.from be in BlockingObservable? #291

Closed
@Treora

Description

@Treora

I imagine Observable.range and Observable.from are so primitive that they are expected to be in the normal Observable, but they are really blocking on subscribe which can be unexpected. In fact it took me a while wondering why my groupBy unit test (4f68c5a) did not work at first (using range instead of a custom CounterSource), before I figured out that it is simply impossible to unsubscribe from range.
According to the plan of moving blocking operators to BlockingObservable (#272), it seems the correct place for these methods (and maybe others?) too, although strictly speaking they might not be operators but generators.

I see two possibilities:
Moving from and range to BlockingObservable:
BlockingObservable<T> source = BlockingObservable.from(items);
or keeping them in Observable but changing their return type, to give the hint to the user:
BlockingObservable<T> source = Observable.from(items);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions