From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,e429176c9adb07b X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-02-17 09:30:17 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!wn12feed!wn14feed!worldnet.att.net!207.217.77.102!newsfeed2.earthlink.net!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread2.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3E511C15.1040404@acm.org> From: Jeffrey Carter User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:1.0.0) Gecko/20020530 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: [OT] Best way to isolate a GUI? References: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 17 Feb 2003 17:30:16 GMT NNTP-Posting-Host: 63.184.33.132 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.prod.itd.earthlink.net 1045503016 63.184.33.132 (Mon, 17 Feb 2003 09:30:16 PST) NNTP-Posting-Date: Mon, 17 Feb 2003 09:30:16 PST Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: archiver1.google.com comp.lang.ada:34171 Date: 2003-02-17T17:30:16+00:00 List-Id: Preben Randhol wrote: > > How do you connect callbacks? Callbacks are an excellent example of a tool's limitations affecting the users' way of thinking (everything looking like a nail if you only have a hammer). Windowing systems result in inherently concurrent processing: the code of the windowing system may be dealing with user interaction while the application program is doing something else. How do you deal with this concurrency? When your thinking is constrained by the limitiations of C, you do it by task inversion: You eliminate the concurrency. Only the windowing code is running; application code is called by the windowing code. How can the windowing code call the application? By having the application register callbacks with the windowing system before handing control of the program over to the windowing system. In C, where nothing is checked and you can call any address, this is easy to do. If one were to design a windowing system with thinking expanded by the use of a language with high-level concurrency features (like, maybe, Ada?), I can't imagine anyone choosing this design. I would think you'd want to associate a concurrent event queue for each window. A task in the application would deal with the events for its window. It could block on the queue to do nothing except respond to events, or it could poll the queue periodically if it has other things to do as well. While I like many things about GtkAda, one of the things I dislike about it is that it hasn't abstracted away this C feature of the GUI. As a result, it's harder to use tasking with GtkAda than it should be. CLAW and JEWL, for example, have abstracted callbacks away to different extents. JEWL effectively implements the concurrent event queue abstraction on top of Windows. -- Jeff Carter "Why don't you bore a hole in yourself and let the sap run out?" Horse Feathers