1.x: scan with an initial factory callback#3959
1.x: scan with an initial factory callback#3959akarnokd wants to merge 2 commits intoReactiveX:1.xfrom
Conversation
|
Why add the overload if it can be done with defer and scan then? |
|
Yep, it can be done. A decision has to be made if this convenience should make it into the library or not, and notify @NiteshKant the outcome in #3667. |
|
I'd like to see this overload in, thanks. |
|
I'm not strong against adding it but not like the idea of the new parameter order. I would give +1 if giving it a better name instead of changing the parameter order. By the way, there is already a Probably @benjchristensen should take a look since you removed it before. |
|
It was removed due to ambiguity as shown in #1881 (comment) As long as that issue is not recreated, I have nothing against the functionality pursued here. I too don't like solving the overload ambiguity by moving parameter order around. But there is no good solution, it's either that or a new name. |
|
As an alternative, I suggest extending |
|
The argument order bothers me as well. I'll close this and post a javadoc update instead. |
This PR adds an overload to
scanwhich allows specifying an initial value factory. The initial value factory is invoked for each incoming Subscriber individually and provides a non-shared starting point for thescanoperation.I propose the
scan(Func2 accumulator, Func0 initialFactory)parameter order because some Java 8+ compilers can't properly disambiguate withscan(R initialValue, Func2 accumulator), thinking that R can be madeFunc0.Related: #3667