English version
Accueil     Ŕ propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis ŕ jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml ŕ l'adresse ocaml.org.

Browse thread
Does LablTk have a future?
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2005-09-01 (13:15)
From: skaller <skaller@u...>
Subject: Re: [Caml-list] Re: Feeding the OCaml GUI troll
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 () =
		read event;
		match event with
		| state_request -> 
		| click -> wait_up()

	and wait_up () =
		read event;
		match event with
		| state_request -> 
		| click ->

is purely functional: it uses the program counter
to maintain state, instead of a mutable state variable.		

John Skaller <skaller at users dot sourceforge dot net>