Re: Haskell extention and Implementing Callbacks with a list
Glynn Clements <[email protected]>
| Newsgroups | gmane.comp.lang.haskell.gui |
|---|---|
| Message-ID | <[email protected]> |
David Sankel wrote: [I don't know whether 1) is practical, but I suspect not.] > 2) Would it not be possible to do callbacks with > lists? > > button [ onClick := [messageBox "hi there"] ] > > add a callback: > > set myButton [ onClick :~ (/a -> newFunction:a) ] > > And if the onClick function found it had an empty > list, it would unregister the callback with the > underlying library. It may be possible, but it's unlikely to be a good idea. IMHO, code should only de-register those callbacks which it knows about. Removing all callbacks, even those which may have been installed for unknown reasons by unknown code (e.g. the toolkit itself) is bound to be wrong. Certainly, Xt allows this (XtRemoveAllCallbacks()); it doesn't, however, make any guarantees regarding the consequences. -- Glynn Clements <[email protected]>