From: Patrick M D. <pa...@wa...> - 2001-11-25 19:28:54
|
I have given some more thought to event-based dispatch and feel that it is too important to ignore. Support for threading on Windows is not fully supported and event-based programs can be easier to reason about. I believe that Gerd was previously in favor of an event-based interface. Any other opinions? Here are some other thoughts related to event-based dispatch: Currently, the pop interface has a general form like this for transactions: val xact : 'request -> 'response The event-based model would look like this: val xact' : 'request -> ('response -> unit) -> unit where the transaction returns immediately. So a block of code written in this style: let rsp1 = xact "req1" in let rsp2 = xact "req2" in ... becomes xact' "req1" (fun rsp1 -> xact' "req2" (fun rsp2 -> ... ); ); I notice that the type for xact' is very similar to the monadic bind operator. Maybe it would be useful to write a camlp4 extension similar to the syntactic sugar in Haskell for monads? Patrick |