archives

The Value Of Syntax?

There seems to be a recurring idea that languages of minimal syntax are difficult for humans to read. Stallman's quote about Lisp looking like oatmeal with fingernail clippings mixed in is an example.

(Edit: Hey! You can edit these things! Who knew?!) As several people have pointed out below, it was not Stallman who said that; rather, it was Larry Wall. I find this amusing, because Perl looks like line noise to me; And yes, I am old enough to remember what line noise looks like. (end edit)

And, actually, I can understand it. In lisp dialects with no reserved words, (such as earlier versions of Scheme) you cannot make any assumptions at all about any subexpression starting with a symbol whose binding you do not know. Because of the parens, you can tell where its influence ends. But if you don't know the binding, you can't even guess from the fully-parenthesized prefix syntax whether it's first-class (a procedure) or first-order (a macro). So, not even the AST structure defined by the parens is necessarily as it appears within such a subexpression. Even more pernicious are symbols whose bindings you *think* you know -- but which may be shadowed by bindings imported from a module which you probably trust not to do anything "insane."

I've heard the same argument against FORTH (which has even less syntax than Lisp) and about operators that don't imply the restrictions that they "ought to" in C++ etc because you have to know whether they're overloaded and if so, how.

I think that it comes down to syntax -- known tokens and relationships between them with truly invariant meanings -- giving people "traction" to reason about code. A little syntax seems to have a significant effect on people's cognitive experience of a language and provides context enabling them to read unfamiliar code, or at least to rule out possible readings inconsistent with the invariant syntax.

But how much does it help? What kinds of syntax provide the most clarity to the most people? Has anybody done comparative studies of syntactically different langauges with near-identical semantics and measured programmer effectiveness? Is there a shred of evidence, in other words, or is this effect merely anecdotal and speculative?

Ray Dillinger

50 in 50: Steele & Gabriel at RailsConf 2011

50 in 50 is another amusing episode of the Guy Steele and Richard Gabriel show.

Each of them make 50 remarks of 50 words in their alotted 50 minutes. The topic is a fond walk through programming language history, punctuated by awkward pauses. I'm not sure whether it's merely good or really great. Unfortunately only available in flash; the HTML5 trick didn't work for me.