Code Monkey home page Code Monkey logo

Comments (3)

staltz avatar staltz commented on August 11, 2024

second Observable emitting items concurrently with the first one

Unless the observables are cold.

main marble diagram of Concat Operator is not fully correct and creates a bit of confusion (at least for my coworker, I was watching diagrams from RxJava javadocs), but probably it's limitation of Js library for marble diagrams.

The confusion arises if you are thinking of hot observables only. By default, RxMarbles displays cold observables. Rx is also cold by default.

That said, I understand that the RxJava diagram is more intuitive. To match that, I would need to build a custom renderer for concat (and maybe a couple of other related ones). It's doable, but I want to get other things solved first, such as a rendering for flatMap and other operators returning Observables-of-Observables.

For now, how about pointing out that these diagrams illustrate cold observables?

from rxmarbles.

DavidMGross avatar DavidMGross commented on August 11, 2024

There's an ambiguity, I think, about how time is represented in marble
diagrams. If time proceeds from left to right and is the same for all
observers (cue spooky floating E=mc² from the Twilight Zone intro), then
the second (cold) Observable shouldn't begin emitting items until it is
subscribed too, which won't happen until the first Observable
completes, which means its emissions should appear to the right of the
first Observable's onComplete notification.

If instead you interpret the left-to-right time as being relative to each
Observable but not the same between Observables, there's no problem with
the diagram as shown. But that approach seems to lead to misunderstandings.

I'd expect if I look over the diagrams I made for RxJava and for the
reactivex.io site, I'd find that I was inconsistent in which of the above
approaches I used. My original concat() diagram was like your rxmarbles
version, but I later changed it after I got complaints about this very
issue.

On Mon, Jul 20, 2015 at 12:24 PM, André Staltz [email protected]
wrote:

second Observable emitting items concurrently with the first one

Not if the observables are cold.

main marble diagram of Concat Operator is not fully correct and creates a
bit of confusion (at least for my coworker, I was watching diagrams from
RxJava javadocs), but probably it's limitation of Js library for marble
diagrams.

The confusion arises if you are thinking of hot observables only. By
default, RxMarbles displays cold observables. Rx is also cold by default.

That said, I understand that the RxJava diagram is more intuitive. To
match that, I would need to build a custom renderer for concat (and maybe a
couple of other related ones). It's doable, but I want to get other things
solved first, such as a rendering for flatMap and other operators returning
Observables-of-Observables.

For now, how about pointing out that these diagrams illustrate cold
observables?


Reply to this email directly or view it on GitHub
#22 (comment).

David M. Gross
PLP Consulting

from rxmarbles.

pforhan avatar pforhan commented on August 11, 2024

+1 to indicating cold/hot Observables. A toggle on subsequent Observables to switch them between cold and hot would be neat.

from rxmarbles.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.