DekGenius.com
[ Team LiB ] Previous Section Next Section

5.1 A "Little Language"

The "little language" philosophy, as expressed in computer languages such as LOGO, Smalltalk, and Scheme, comes in various forms; but the very words, "little language," tell you most of what you need to know. Littleness can be a virtue in a number of ways. A little computer language can fit in a small space and be run by a small interpreter. A little computer language can be easy to learn. A computer language is a tool to make tools, so the initial tool itself can be quite minimal, provided it has the power to make any other tools that may prove necessary.

All of these notions apply to AppleScript. AppleScript was to be easy for users to learn, so the less there was of it, the better. AppleScript appeared at a time when the idea of a computer with as much as four megabytes of random-access memory still felt rather strange and extravagant. To minimize expenditure of resources of time and space, it had to be compilable with just a single pass. In these days of hundreds of megabytes of RAM and dozens of processes running simultaneously, it's easy to forget that AppleScript comes from a day when running more than one application at once on your Macintosh was a relatively new experience, and liable to tax the computer's resources to the utmost. At the time, AppleScript itself needed to be small simply to stay out of the way of other applications. The first version of AppleScript could load a scripting component instance and run a heavily recursive script in less than 300K of RAM.

And after all, those other applications were the whole point. The purpose of AppleScript was to tell other programs to do things. Thus AppleScript itself could afford to be so minimal as to have next to no power of its own. AppleScript has minimal string-munging and number-crunching facilities, but then AppleScript is not intended for munging strings or crunching numbers—it's made for driving applications, and they can munge the strings and crunch the numbers if need be.

So is AppleScript's littleness a virtue? Well, if you're used to a full-fledged scripting language—Perl, for instance—AppleScript comes as something of a disappointment. Perl has some hundreds of built-in functions; AppleScript has about a dozen. Perl has built-in support for regular expressions and trigonometry; AppleScript doesn't. The "little language" philosophy seems very cute just until you actually need to get something done. On the other hand if you don't try to misuse it, AppleScript seems quite adequate, especially since it can avail itself directly of the power of Perl and other built-in Unix tools. As I said in Chapter 1, success may simply be a question of combining specialities appropriately.

    [ Team LiB ] Previous Section Next Section