Why aren't Signals called Observables?

1,229 views
Skip to first unread message

Charlie Koster

unread,
Jan 19, 2016, 1:46:42 PM1/19/16
to Elm Discuss
I'm not proposing a name change but as someone who is just getting into FRP and looking at similar libraries (like RxJS) it seems that what a Signal represents is pretty much what most other libraries call an Observable. If they're different, what's the difference? Am I wrong in thinking that Signals are analogous to Observables in RxJS?

Max Goldstein

unread,
Jan 19, 2016, 2:07:26 PM1/19/16
to Elm Discuss
Probably because every good programming language idea gets about four different names. "Signal" communicates that a value changes better than "observable". Constants can be observed!

One slight difference between Elm Signals and other reactive patterns is that Signals are always defined. Rather than transient event streams, you can access the last value on a signal long after it occurred. Signals are continuous but change discretely.

Aaron VonderHaar

unread,
Jan 19, 2016, 4:28:53 PM1/19/16
to elm-d...@googlegroups.com
Observables are significantly more complicated than Signals. Notably,
Observables have completion and error events, but `Observable a` is
still different from `Signal (Result err (Maybe a))` because
observables can no longer produce values after an error or completion.
Observables also include the concept of subscribe/unsubscribe events,
which has no corresponding concept in Signals.
> --
> You received this message because you are subscribed to the Google Groups
> "Elm Discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to elm-discuss...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Charlie Koster

unread,
Jan 19, 2016, 7:57:45 PM1/19/16
to Elm Discuss
That makes sense. Thanks for clarifying.

Irakli Gozalishvili

unread,
Jan 21, 2016, 3:54:44 PM1/21/16
to Elm Discuss
Charlie Evan in fact wrote a paper that explains reasons of why Elm chose to go with Signals and how they are different from Events and Behaviors found in classical FRP: http://elm-lang.org/papers/concurrent-frp.pdf

As off difference between signals and observables there are several and some of the have being already pointed out. Observables are more like Events in classical FRP married with Iterators. Events in classical FRP are nothing but a stream of events, unlike signals they don't have value that changes over time, nether they have value at a given time. In classical FRP there were Events and Behaviors and with combination of two you could get something like Signals which I believe were introduced in Real-time FRP. Observables do also have traits of Iterators that is also why they have notion of end & probably error which is still an end but unsuccessful.

 


On the other hand a Signal is a value that changes over time, which implies it represents a value at a given tim and any point in time. End of signal makes no sense because signal is representation of value which can be of error type or not.

Rindra Ramamonjison

unread,
Mar 25, 2016, 6:38:43 AM3/25/16
to Elm Discuss
The concepts are similar but have important differences. 

In ReactiveX: 
- signals (or observables) are not always infinite. They have a start and can be ended. In particular, cold observables.
- signal graphs are not static, i.e you can create an observable of observables and join observables back. In ReactiveX lingo, this is flatMap.


In Elm: 
- signals are usually infinite. They simply represents values that change over time. Even if no one is observing them, they are changing (e.g. mouse position)
- signals graphs are static. You cannot have signals of signals by design.
- signals are synchronous by default.

Evan has the best explanations in the following video

Reply all
Reply to author
Forward
0 new messages