On Fri, Aug 22, 2014 at 5:44 PM, <
pcxunl...@gmail.com> wrote:
> Oh, I see. That makes sense. I agree that observables seems like a more
> general pattern, and so it should be in SJS rather than MHO. In fact, it
> almost seems strange to me that observables have a special "observe"
> function which seems to do essentially the same thing as
> "sequence/transform", except it accepts multiple observables.
Yes, I understand that it might seem a little odd. The thing is,
`observe` actually does a few more things than `transform`: When one
of the input streams emits a new value while the transform function is
busy, then the current pending execution will be aborted and the
transform function will be called with the new value.
The idea here is that for streams with 'observable' semantics, the
downstream receiver will not be interested in receiving *every* value,
but the most recent value.
The sequence primitives can be a bit hard to wrap your head around,
because they can be applied to (at least) three types of constructs:
'arrays' or 'array-like' sequences, observable streams, and event
streams. All of these are pretty much the same thing (which is why we
can have primitives which work with all of them) - they are only
differentiated by the semantics expected of them.
We need to do a much better job of explaining the differences, but I
think our docs are slowly getting better :-)