[GUI] Another call for votes

Glynn Clements glynn.clements@virgin.net
Tue, 18 Mar 2003 23:44:51 +0000


Nick Name wrote:

> >  Not if you want to support multiple callbacks for each event. In that
> >  case, you need to be able to identify a specific callback, which gets
> >  us back to the issue of equality of function types.
> > 
> >  Unfortunately, the easiest solution (require the application to
> >  provide a FunPtr, as that's what's going to be passed to the lower
> >  levels) is also the ugliest.
> 
> I am perhaps missing the point.

The point is that if:

a) you want multiple callback procedures for a single event, and
b) you want to be able to de-register individual callbacks,

then there has to be some way of specifying *which* callback procedure
you wish to de-register. Given that functions (or plain IO actions, in
the case where the callback doesn't take parameters) don't implement
Eq, you can't just pass the expression which was passed to the
registration function.

It doesn't matter whether the underlying toolkit supports multiple
callbacks directly or whether you emulate them; the problem is in
deciding upon the Haskell interface.

> > you can create the FunPtr
> 
> or else, of course, to be portable, you can assign an unique integer to
> any registered callback, wich is then used to unregister it.

AFAICT, if you're going to have the registration function return some
kind of entity to enable a specific procedure to be de-registered, you
may as well just return a "canned" IO action.

-- 
Glynn Clements <glynn.clements@virgin.net>