[GUI] Re: GUIs and events/callbacks
Nick Name
nick.name@inwind.it
Mon, 10 Mar 2003 12:47:43 +0100
On Mon, 10 Mar 2003 12:17:07 +0100
George Russell <ger@tzi.de> 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