[GUI] Another call for votes

Nick Name nick.name@inwind.it
Tue, 18 Mar 2003 13:35:49 +0100


On Tue, 18 Mar 2003 12:33:44 +0100
Daan Leijen <daanleijen@xs4all.nl> wrote:

> 
>  I disagree with this design. It is very awkward to install callbacks
>  this way as we have to maintain the "unregister" function. We can no
>  longer use "nice" syntax like:
> 
>    button [on click := messageBox "hi there"]

You can have the "unregister onClick action" in the resulting
"ButtonType" value, just as you keep there other important attributes of
a button.

> 
>  I also think that "register/unregister" is a confusing name. Here is
>  my proposal. We have two functions for each event type. One to set
>  the current callback, and one to get the current callback. (there is
>  only one callback at any time).

Yes, but: if you want to modify the current callback, for example to
append another with ">>", you have to lock it if there are other haskell
threads; you can't just get it, modify and put back, you need a
"modifyCallback" action. This can be implemented with MVars of course.

The other way around, wich is "registerCallback :: (a -> IO b) -> IO (IO
())" is more useful if one allows more than one callback at a time. It
seems to me that one thing is implementable by the other, by tricking
with functional equality, so I guess we will choose the one that matches
more toolkits.

Vincenzo