From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id JAA14418; Thu, 1 Apr 2004 09:24:42 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id JAA14667 for ; Thu, 1 Apr 2004 09:24:41 +0200 (MET DST) Received: from oxy.exomi.com (fa-3-0-0.fw.exomi.com [217.169.64.99]) by nez-perce.inria.fr (8.12.10/8.12.10) with ESMTP id i317PPjq017571 for ; Thu, 1 Apr 2004 09:25:25 +0200 Received: from [127.0.0.1] (localhost [127.0.0.1]) by oxy.exomi.com (Postfix) with ESMTP id 7AC63193965; Thu, 1 Apr 2004 10:25:26 +0300 (EEST) In-Reply-To: <16491.38344.186267.44292@soggy.deldotd.com> References: <16491.38344.186267.44292@soggy.deldotd.com> Mime-Version: 1.0 (Apple Message framework v613) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit Cc: caml-list@pauillac.inria.fr From: Ville-Pertti Keinonen Subject: Re: [Caml-list] exene and ocaml ? Date: Thu, 1 Apr 2004 10:25:25 +0300 To: briand@aracnet.com X-Mailer: Apple Mail (2.613) X-Miltered: at nez-perce by Joe's j-chkmail ("http://j-chkmail.ensmp.fr")! X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 threading:01 ocaml's:01 threads:01 threads:01 gui:01 model:01 guis:01 lablgtk:01 recursively:01 modal:01 ocaml:01 ocaml:01 garbage:01 imho:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk X-Status: X-Keywords: X-UID: 7 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