Hello, Thank you very much for your prompt reply.
(2012/04/18 16:36), Daniel Bünzli wrote:
1) Thread-safety and compositionality. React has no global data structure.
I'm sorry about my misunderstanding that React has a global structure.
2) Semantic issues. As soon as primitive events are triggered by other primitive events you run into the problem of multiple occurences of the same event during an update cycle. Now given the synchrony hypothesis of update cycles (an update cycle is instantaneous), this is a violation of the semantics of events (an event has at most one occurence at any given time t). And then people ask you if you can somehow manage the order of updates in an update cycle and then you are not doing FRP anymore, you are doing RP. By loosing the F you also loose compositionality and the equational reasoning tools provided by the denotational semantics of events.
I see that React is implemented with intend to keep good semantics and able to realize same functions as PEC. But PEC dose not violate good semantics either. PEC treats only one event at any given time t. Please see blow code. module E = Pec.Event.Make (Pec.EventQueue.DefaultQueueM) (Pec.EventQueue.DefaultQueueI) open Printf let _ = let e, sender = E.make () in let e' = E.map (fun x -> sender 2; x + 1) e in (* during update cycle, send 2. *) let _ = E.subscribe (printf "e=%d\n") e in let _ = E.subscribe (printf "e'=%d\n") e' in sender 1; ignore (E.run ()); (* run one event *) printf "---\n"; ignore (E.run ()); (* run one event *) printf "end\n" This program outputs: e=1 e'=2 --- e=2 e'=3 end The function (fun x -> sender 2; x + 1) is not purely functional. I see that violates a part of good semantics and composability. But there is no problem of multiple occurrences of the same event in one update cycle. To write event driven systems such like GUI sometimes needs a event-event chain without real-user actions. Sending events during update cycle is something unavoidable.
Regarding the absence of Weak usage I'm curious in how you manage the garbage collections of events that depend on others.
Yes, weak-pointer-less implementation is one of my purpose. The key point is that dependency of events are represented by nested variants. Best Regards, Ogasawara -- Caml-list mailing list. Subscription management and archives: https://sympa-roc.inria.fr/wws/info/caml-list Beginner's list: http://groups.yahoo.com/group/ocaml_beginners Bug reports: http://caml.inria.fr/bin/caml-bugs