Re: Re: GUIs and events/callbacks

Nick Name <[email protected]>
Newsgroups gmane.comp.lang.haskell.gui
Message-ID <[email protected]>
On Mon, 10 Mar 2003 12:17:07 +0100
George Russell <[email protected]> wrote:

> 
>  Yes.  You'll see I provided an IO *action*
> 
>      clicked :: Clickable widget => widget -> IO (Event ())
> 
>  This tells the toolkit to *generate* an event whenever a button (or
>  whatever "widget" is) is clicked.
> 
>  I agree that the alternative, for general GUI events, would be
>  unacceptable.

The true problem here is that once you got an Event, you never uninstall
the callback, even if you just take the first n events and then stop
using the stream. This can be really expensive; do you use finalizers to
uninstall the callback?

I have entirely rewritten my "Var" library to handle many problems, and
used finalizers to uninstall the callbacks in a particular instance of
the datatype.

Response is prompt when there is some sort of memory allocation in the
program. If the program just sleeps there waiting for an event, at least
in my tests, it doesn't garbage collect the stream, so it does not
uninstall the callback. 

Well, I am not saying that the problem is unsolvable, and I hope it is,
but I have still to try a couple of alternatives.

Vincenzo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.