RxJava icon indicating copy to clipboard operation
RxJava copied to clipboard

3.x: Disambiguate startWith(T|Iterable<T>)?

Open akarnokd opened this issue 8 years ago • 6 comments

We were using postfixes to avoid inference problems around operator methods (such as fromIterable vs fromArray) but there is at least one operator currently, startWith, that may exhibit type ambiguity. A dedicated postfixed name should resolve the issue, such as:

  1. startWith(T) + startWithIterable(Iterable<T>)
  2. startWithItem(T) + startWith(Iterable<T>) + remove startWith(T)
  3. startWithItem(T) + startWithIterable(Iterable<T>) + remove startWith(T).

As a preparation, we can deprecate startWith(T) within 2.2.x in case option 2 or 3 is chosen.

akarnokd avatar Aug 01 '18 13:08 akarnokd

The same also happens with some onError* methods.

I'm more inclined towards option 3 but no strong opinion.

vanniktech avatar Aug 09 '18 12:08 vanniktech

For 3.x I'm happy with 3 also.

davidmoten avatar Aug 09 '18 12:08 davidmoten

Perhaps instead of startWithItem we use startWithJust to match our just usage?

davidmoten avatar Aug 09 '18 13:08 davidmoten

That's just my two cents' worth I would opt for the option 3.

I think startWithJust could be confusing since other methods call just for example, range when the count value is one or fromArray when the length is one.

RomanWuattier avatar Feb 17 '19 11:02 RomanWuattier

3.x is now accepting PRs if somebody wants to tackle this.

akarnokd avatar Jun 19 '19 11:06 akarnokd

Closing via #6530.

akarnokd avatar Jun 21 '19 11:06 akarnokd