From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id B9E05BDE9 for ; Thu, 1 Sep 2005 15:15:39 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j81DFdBx026306 for ; Thu, 1 Sep 2005 15:15:39 +0200 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 PAA22501 for ; Thu, 1 Sep 2005 15:15:38 +0200 (MET DST) Received: from smtp3.adl2.internode.on.net (smtp3.adl2.internode.on.net [203.16.214.203]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id j81DFa8I016166 for ; Thu, 1 Sep 2005 15:15:37 +0200 Received: from rosella (ppp32-47.lns1.syd2.internode.on.net [59.167.32.47] (may be forged)) by smtp3.adl2.internode.on.net (8.12.9/8.12.6) with ESMTP id j81DFTXD057417; Thu, 1 Sep 2005 22:45:29 +0930 (CST) (envelope-from skaller@users.sourceforge.net) Subject: Re: [Caml-list] Re: Feeding the OCaml GUI troll From: skaller To: Matt Gushee Cc: caml-list@inria.fr In-Reply-To: <43168841.9000302@havenrock.com> References: <20050830174757.99765.qmail@web30510.mail.mud.yahoo.com> <200508302001.58080.jon@ffconsultancy.com> <3d13dcfc05083101487092acd5@mail.gmail.com> <43168841.9000302@havenrock.com> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="=-W37T+mj82m5CkNMe1DlE" Date: Thu, 01 Sep 2005 23:15:28 +1000 Message-Id: <1125580528.7192.23.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.2.1.1 X-Miltered: at concorde with ID 4316FEFB.002 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at nez-perce with ID 4316FEF8.003 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 ocaml:01 callbacks:01 threads:01 gui's:01 inverting:01 widget:01 rec:01 mutable:01 wrote:01 sourceforge:01 sourceforge:01 thread:02 purely:02 match:02 X-Attachments: type="application/pgp-signature" name="signature.asc" X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 --=-W37T+mj82m5CkNMe1DlE Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On Wed, 2005-08-31 at 22:49 -0600, Matt Gushee wrote: > I'm not sold on the idea of a "simple" GUI front end. I am. My idea is this: GET RID OF CALLBACKS. The idea is to use (user space) threads instead. The big problem with GUI's is that they're passive. You write 'event handlers' and have to store the current state manually. By control inverting the code, you can just use a thread for each widget. For example for a button something like: let rec wait_down () =3D read event; match event with | state_request ->=20 send(up);=20 wait_down() | click -> wait_up() and wait_up () =3D draw_button_down(); read event; match event with | state_request ->=20 send(down);=20 wait_up() | click -> draw_button_up() wait_down() is purely functional: it uses the program counter to maintain state, instead of a mutable state variable. =09 --=20 John Skaller --=-W37T+mj82m5CkNMe1DlE Content-Type: application/pgp-signature; name=signature.asc Content-Description: This is a digitally signed message part -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) iD8DBQBDFv7usRp8/9aGVGsRAqr9AJ9BQAKup4DcIbbiq5FX5mnTtOsZIACfU/JU W1GslrYG1E5iiYQlur0KWNY= =1G/6 -----END PGP SIGNATURE----- --=-W37T+mj82m5CkNMe1DlE--