Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.csd.uwm.edu!cs.utexas.edu!uunet!sjsca4!news
From: enk@corona (Edan Kabatchnik)
Newsgroups: comp.sys.mac.programmer
Subject: Re: Real Multifinder
Message-ID: <1989Aug16.175747.24394@sj.ate.slb.com>
Date: 16 Aug 89 17:57:47 GMT
References: <46100321@uxe.cso.uiuc.edu> <1989Aug15.001507.14552@sj.ate.slb.com>\ <24626@iuvax.cs.indiana.edu> <3576@internal.Apple.COM>
Sender: enk@slcs.slb.com (Edan Kabatchnik)
Reply-To: enk@slcs.slb.com (Edan Kabatchnik)
Organization: Schlumberger Technologies ATE, San Jose, CA
              Massachusetts Institute of Technology, Cambridge, MA
Lines: 37

>Well, some folks think Unix should be done away with ;*).  I think that if
>you gain some experience with the Mac, you'll find that the main event
>loop is a good way to write event-driven programs, and this is central to
>implementing the Mac user interface.  There is absolutely nothing
>difficult about writing an event loop.  It is not the same thing as
>writing a program to run under Unix or DOS or VMS, but so what?

     Granted, (parts of) UNIX should be done away with.  But, there is a
superior form to the main event loop: callbacks (found in X and Xerox
Artificial Intelligence Workstations from which the Macintosh developed its
user interface.)  Instead of having to dispatch on every possible event in the
main event loop, one establishes a hook that is automatically called when an
event takes place.

        Example: when creating a menu, each item that can be selected
        in the menu is given the address of the function which should
        be called when that item is selected.

     So, the programmer does not call his menu handler explicitly; rather, it
is "magically" called by the menu code in the toolbox when the selection
occurs.  This takes away all the pains of the main event loop.  (The main event
loop is reduced to a few standard lines of code that need not dispatch on
event.)

     So much code has been written for the Macintosh which works without
callbacks, making it unlikely that future versions of the system will take
advantage of callbacks.  But, if Apple could figure out a way of making both
systems work, then future programmers would be spared a great deal of pain.

+----------------------------------------------------+-------------------------+
|There is a club if you would like to go.            |     Edan Kabatchnik     |
|You could meet somebody who really loves you.       +-------------------------+
|So you go, and you stand on your own.               |           MIT           |
|And you leave on your own.                          | enk@wheaties.ai.mit.edu |
|And you go home, and you cry, and you want to die.  |Schlumberger Technologies|
|                                   - The Smiths     |    enk@slcs.slb.com     |
+----------------------------------------------------+-------------------------+