Hello,

(2012/04/18 4:23), Daniel Bünzli wrote:
- PEC's update cycle is separated from sending events.
You can send a value to event during update cycle.
What's the semantics if you send two different values to an event during an 
update cycle ?

They fires two different event if you send two different value to an event
even if same update cycle. Events send are stored in an event queue,
and they will be poped by 'run' function just like GUI event loop.

- PEC doesn't hold any pointer(including weak one) to event until the
event will be subscribed.
I'm not sure how that's different from react. If an event has no dependents (by which I 
understand your "subscribed"), react doesn't hold any pointer either.

React constructs 'heap' to hold dependency graph inside the library.
let e' = map (fun x -> x + 1) e, the e' and e are weakly pointed by the heap.
PEC doesn't have heap structure in the library. This is a difference.

This difference is important if you want to translate the OCaml event
combinator to javascript because javascript doesn't have weak pointer.

- All PEC's signal are switchable. 'switch' means you can replace dependency
of a signal keeping signals depends on the signal unchanged.
How is that different from react's E.switch/S.switch ?

Almost same except all signals are created though react's S.switch at 
initializing.

It's convenient to design library for dynamic event driven systems. For example,
let me assume a signal of window size property.

type window = {
   size : (int * int) signal;
}

If you want to change the dependency of window.size after initialize the window
keeping signals depends on the size unchanged, there is no way except making 
switch
event at initializing.

type window = {
   size : (int * int) signal;
   size_switch_event : (int * int) event event;
}

I feel it's not convenient. So I decided to embedded the swith_event to inside 
of signals.

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

Reply via email to