Hi, On 2/7/07, minh thu <[EMAIL PROTECTED]> wrote:
What I Don't Like About Callbacks. a) Putted simply, you can't mix gui events with application specific events. b) (which is related) Since a function call results from an event, you can't generate an event whose callback needs the end of the event-generating-computation (i.e. it's not asynchronous).
Luckily, Scheme has first class continuations which overcome all such obstacles! :) Mixing interaction and computation is a common problem, which different apps handle in different ways. This is the cause of one of the great user banes, the modal window. Because typically the programmer can only process through one computation stack at a time, she often resorts to forcing the user through a strict GUI sequence with such windows. Somewhat more flexibly, Emacs, when accepting input for an extended command, manually keeps track of the command being called and the inputs received so far, and lets you suspend this and switch to a different task with something called a "recursive edit." It has various limitations and is only available for registered commands, not arbitrary functions. However, edwin, the MIT Scheme editor (and other Scheme based Emacs clones), allows you to suspend any computation at all with call/cc. Thus you can have a natural flow with the user jumping back and forth between arbitrary user interactions and computations. The same could apply for any arbitrarily complex graphical app, or even over a client server split, as has recently been the rage with continuation based web servers. -- Alex _______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org http://lists.nongnu.org/mailman/listinfo/chicken-users