[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Ville-Pertti Keinonen <will@e...> |
| Subject: | Re: [Caml-list] exene and ocaml ? |
On Apr 1, 2004, at 7:08 AM, briand@aracnet.com wrote: > Has anyone in the ocaml community ever even considered porting this to > ocaml ? I noticed that it requires threading. Does anyone have an > opinion as whether ocaml's threads would be compatible with such a > system ? It seems eXene doesn't depend on first-class continuations directly, so a port may be possible. CML threads are several orders of magnitude more lightweight than OCaml threads and are garbage collected (they disappear if they are blocked in a state that they could not wake up from), so a direct port is IMHO probably not worth attempting. > Thread based gui implementations are the way to go (aren't they ?) It's one way to do things, but by no means the only way. A single-threaded event model works reasonably well for GUIs, especially in most current languages where threads are needlessly expensive. > Consider the much more elegant and functional implementation: > > new line = draw_line event_stream > > draw_line event_stream > consume events until done > return tuple (success/fail, line object) How is this approach dependent on threads? I don't know about lablgtk, but something like the above is generally possible by recursively calling the main event loop with the appropriate locally added handlers. You can escape your modal loop without modifying "globals" (I don't see why state variables would need to be global) e.g. using exceptions (or continuations, which in OCaml would require using CPS for the event loop). ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners