Although LISP (the name comes from LISt Processing) has been around since the late 1950s, it has never been as popular as newcomers like C and Pascal. LISP has nourished in the artificial intelligence community, however, and wherever people need large and flexible data. Apple recently announced version 1.3 of the current standard, Macintosh Allegro Common Lisp (MACL), which should make users happy. MACL has an excellent debugger, and MACL makes it easy to link LISP code with Toolbox calls and dialog boxes to build LISP programs with very proper Macintosh user interfaces.
Although this situation is certain to change when Apple upgrades the Macintosh System software to include virtual memory, version 1.3 of MACL can access only 8 megabytes of storage space. MACL comes with 2600 Common Lisp functions that are already compiled, but fortunately they are not loaded from the disk until they are called. You can adjust the compiler to use various levels of error-checking, memory usage, and speed, and the compiler uses these settings to control the extent of optimizations such as, for example, constant folding, type checking, and inline expansion of functions.
Almost Object Oriented
Version 1.3 of Macintosh Allegro Common Lisp includes a set of object-oriented extensions called Object LISP, which is weakly classed and supports multiple inheritance and method combination. A future version of MACL will reportedly contain the complete standard Common Lisp object system (CLOS) embedded in the software. In the meantime, a similar object-oriented system, PCL, can be purchased separately from the Apple Programmers and Development Association.
The Interface
Version 1.3 offers programmers a productive working environment. In addition to the well-designed editor, MACL includes an object inspector and a good debugger. The center of MACL is the editor shell, appropriately named with the recursive acronym FRED (Fred resembles Emacs deliberately). This shell is used by the windows where programs are edited and in the Lisp Listener windows where the execution of programs takes place. The editor is easy to extend and customize because you can create new commands, and bind them to keys, with LISP itself. The editor automatically balances parentheses and displays the arguments of any function in a mini-buffer at the base of the window. The editor makes programming a great deal easier.
The user interface also includes an excellent data Inspector that displays the value of every function or variable in a separate window. Additionally, you can now use the inspector to look at the internal representation of any data object. These windows themselves contain objects that can be inspected recursively until you reach the base level of the data structure. The Inspector window of a number, for instance, displays what type number it is (either integer, floating-point, or the boundless bignum) and also represents the number in either binary, octal, decimal, hexidecimal, or even Roman numerals.
The actual execution of a LISP program is easy to follow when you are using the debugger to follow the execution of your code. It displays variables and the MACL system stack whenever the program encounters an error or a breakpoint. The debugger window contains a great deal of Information about the frame size and the program counter at this point. You can also walk through the execution of LISP expressions and watch the execution of each subpart of a function. You can find out just what the compiler is doing by disassembling the functions and reading the 68000 code.
Making a Macintosh Interface
The most impressive thing about the Macintosh version of Allegro Common Lisp is that it provides hooks that you can use to create a Macintosh-like interface for custom programs. The centerpiece of the MACL system is the Allegro Interface Designer (AID), which enables you to create windows easily. You can create new windows and then drag the correct controls into place using the mouse (see “The Interface Interface”). The controls themselves can be edited to have a complete range of fonts, colors, and sizes. When AID detects that a control has been pressed, it calls the appropriate background function. I have used systems like Prototyper and MacApp, but the AID system is the fastest way I have found yet to generate completely working systems.
If you aren’t interested in using the prebuilt controls, or if you need to modify them a bit, you can make direct calls to the Macintosh Toolbox to build custom windows. The Toolbox routines are written in Pascal, and MACL has the necessary functions built in for easy translation between MACL and Pascal structures. You can also call any function built with the Macintosh Programmer’s Workshop with MACL’s Foreign Function interface.
LISP Stands Alone
After you’ve gone to the trouble of producing all of this work, you can create a stand-alone application that runs without the Common Lisp environment. This would be an ideal way to distribute finished programs if the application files were of manageable size. Unfortunately, the smallest ones are about 750K and the larger ones can be easily twice that. Because of this I would only consider using MACL for a stand-alone application if the background processing required LISP. Otherwise, I would build it with another system.
The programming environment of Macintosh Allegro Common Lisp is decidedly one of the best around. The debugger is excellent and the interface design system is superb. While it is true that LISP might not be the best thing for performing rapid computation or creating efficient programs, it is an ideal language for prototyping systems and experimenting.
Wayner, Peter. (August 1990). Macintosh Allegro Common Lisp 1.3. Macworld. (pgs. 193-194).