Re: Another call for votes

Glynn Clements <[email protected]>
Newsgroups gmane.comp.lang.haskell.gui
Message-ID <[email protected]>
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 <[email protected]>
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.