What is the definition of a \"glitch\" in the context of Functional Reactive Programming?
I know that in some FRP frameworks \"glitches\" can occur while in others n
Here is an extremely short and theoretical example of a fatal "glitch" situation in C# RX
var t = Observable
.Interval(TimeSpan.FromSeconds(1))
.Publish()
.RefCount();
var s = t.CombineLatest(t, (t1,t2) => 1/(1-(t1-t2));
Since t1 and t2 both represent the latest value of the hot observable t, one would assume t1-t2 to always be 0. So s should always be 1.
But when subscribing to s, we indeed get 1 as the first observed value, but then we get a division by zero exception. In RxJS we would get NaN.
The reason is simple: a.CombineLatest(b, f) will react when either a or b produces a value, combining this new value and the last observed value of the other observable. This is by design, but from my experience, people using RX sometimes consider these to be glitches, especially when coming from other FRP libraries that have a different notion of "latest".
This is of course a contrived example, just meant to illustrate a misconception about CombineLatest.
Maybe CombineLatest should have been called WhenAny as in the ReactiveUI library, this would clarify the operational semantics?