Alan Baer on English SyntaxAlan Baer, email@example.com, is a webmaster at Lands' End.
As someone who has used both Macs and PCs for years, I admire Apple. Compared to a PC, the Macintosh is still better designed, easier to use, and more elegant.
However, starting with Hypertalk and continuing on with AppleScript, I think Apple made a major blunder attempting to develop scripting languages with "English-like" syntax. Programming is not English. Pretending it is confuses beginners and annoys advanced users. Programming is hard work not because most syntaxes lack definite articles and prepositions, but because ...
Programming is unforgiving. Real language is approximate, fluid, self-righting. A speech does not end when the speaker stutters; a book doesn't end at page 32 because of a typo there. In contrast, programming languages are profoundly unforgiving. One missed semicolon, one typo, one "=" instead of "==", produces an error at best and more likely a wholesale failure to execute or compile. Therefore, an English-like syntax is a lie: it promises a language-like will-to-understanding where none exists.
Programs need to be told everything. Admittedly, I'm at best a decent amateur programmer. But programming often reminds me of that game called "Martian" where you blindfold somebody and attempt to instruct them to do some simple task using verbal instructions alone. You don't realize quite what's required until you've bruised your poor alien a few times, running him into walls and tripping him on cords. Likewise, programming is hard because everything needs to be specified, even things you never thought of.
Fundamentally, programming is not a linguistic enterprise. The basics of programming -- control structures, algorithms, data structures, etc. -- simply have little in common with language. Language is the wrong model. Applescript doesn't innovate programming language fundamentals at all; it just obscures them with an "English-like" facade.
I could go on. But two more points. The major language that was developed by a linguist -- Perl -- is in many ways the opposite of AppleScript. It's rich in symbols, not definite articles and prepositions. You can go a fair ways into a Perl program before you find anything that looks like a "word" at all. Instead, Perl draws from language on deeper levels. For example, it uses context -- an operator in one context does a different thing from an operator in another context. It aims to provide many ways doing something, not just one way. Addressing the need to be told everything, Perl has a lot of unsaid stuff that can be drawn on by the program, saving time. (One simple example: the $_ variable).
Frontier, too, has a far clearer, more powerful, more understandable (and thankfully less "English-like") syntax than Applescript. Here, at random, are lines the Quark manual, showing Frontier vs. Applescript ways to accomplish the same thing. Which would you choose?
APPLESCRIPT: set every generic box whose name of color equals "Green" to "Red"
APPLESCRIPT: set the kern of character 1 of word 2 to -14
You get the idea.
This page was last built on 5/11/98; 2:35:44 PM by Betty Webmaster. firstname.lastname@example.org. At the moment I am using Windows NT to work on this website.