caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Ville-Pertti Keinonen <will@exomi.com>
To: briand@aracnet.com
Cc: caml-list@pauillac.inria.fr
Subject: Re: [Caml-list] exene and ocaml ?
Date: Thu, 1 Apr 2004 10:25:25 +0300	[thread overview]
Message-ID: <BE2D84E8-83AD-11D8-96B0-000393863F70@exomi.com> (raw)
In-Reply-To: <16491.38344.186267.44292@soggy.deldotd.com>


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


  reply	other threads:[~2004-04-01  7:24 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-01  4:08 briand
2004-04-01  7:25 ` Ville-Pertti Keinonen [this message]
2004-04-01  8:19   ` skaller
2004-04-01  9:24     ` Ville-Pertti Keinonen
2004-04-01 14:08       ` skaller
2004-04-11  6:46         ` briand
2004-04-11  8:41           ` skaller
2004-04-11  9:02             ` Richard Jones
2004-04-11  9:26               ` skaller
2004-04-11 13:21           ` Ville-Pertti Keinonen
2004-04-01 14:34       ` skaller
2004-04-02  5:09       ` briand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BE2D84E8-83AD-11D8-96B0-000393863F70@exomi.com \
    --to=will@exomi.com \
    --cc=briand@aracnet.com \
    --cc=caml-list@pauillac.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).