While I don&#39;t agree that push/pull is not relevant, I totally agree on the glitches of the observer pattern you described here, which IMO make the observer pattern only really practical in a model/view setting, where the view is observer and the model is the subject. <div>
<br></div><div><div><div><div><div><div class="gmail_quote">2009/6/9 Daniel Bünzli <span dir="ltr">&lt;<a href="mailto:daniel.buenzli@erratique.ch">daniel.buenzli@erratique.ch</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I don&#39;t think the push/pull issue is relevant to the discussion about frp and the OO observer pattern. The push/pull issue is an (important) implementation detail of FRP.<br>
<br>
Le 9 juin 09 à 19:09, Álvaro García Pérez a écrit :<div class="im"><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
This has similarities to the OO Observer pattern (in fact, you can implement it using the pattern) and is also supported in some new scripting languages as JavaFX.<br>
</blockquote>
<br></div>
One thing the observer pattern doesn&#39;t give you is any guarantee on the order of updates: when the observed value changes it updates all the observers in no specified order. However if a value observes more than one value this may result in glitches (i.e. values you actually don&#39;t want to see).<br>

<br>
For example suppose your value dependencies are as follows :<br>
<br>
a = b + c<br>
b = c + 1<br>
<br>
i.e. a observes b and c, and b observes c and initially we have :<br>
<br>
c = 0<br>
b = 1<br>
a = 1<br>
<br>
If c updates from 0 to 2 any of the following two sequences of updates may be seen with the OO observer pattern :<br>
<br>
c = 2; a = 3; b = 2; a = 4;<br>
c = 2; b = 2; a = 4;<br>
<br>
But usually you don&#39;t want to see the a = 3, it&#39;s a glitch. FRP systems update the graph of dependencies in topological order (i.e. they ensure before updating a value that each value it depends on has been updated) and you are guaranteed you&#39;ll only see the second sequence of updates.<br>

<br>
FRP can be seen as a form of value observation in the sense that changes in a value get eventually propagated to other values that depend on it. But it is clearly not the same as the OO observer pattern as usually understood/implemented because of this ordering issue. FRP is more subtle and powerful in the management of the value&#39;s dependency graph.<br>

<br>
Best,<br><font color="#888888">
<br>
Daniel_______________________________________________</font><div><div></div><div class="h5"><br>
Reactive mailing list<br>
<a href="mailto:Reactive@haskell.org" target="_blank">Reactive@haskell.org</a><br>
<a href="http://www.haskell.org/mailman/listinfo/reactive" target="_blank">http://www.haskell.org/mailman/listinfo/reactive</a><br>
</div></div></blockquote></div><br></div></div></div></div></div>