And now you've got me curious, so I've read it. It's an interesting
article, but it could be made a lot shorter.
I hereby present the full text of the proposed Second Edition:
WHY C IS NOT MY FAVOURITE PROGRAMMING LANGUAGE
Because I prefer Lisp.
I was also curious, came to a conclusion similar to
Mr. Heathfield's, but less succinctly....
The claim that a language like Common Lisp is, a priori,
more productive than C seems *very plausible* to me
(though I'd prefer C anyway for reasons not germane to
this discussion), and I eagerly read two of the references
cited in this thread hoping one would be articulate enough
to explain *why* Common Lisp is better.
Boy, was I disappointed. The Hudak-Jones paper, where
one of the tested languages was 'awk', seemed silly
to me. "Prototyping"? Isn't that where you write
code that pretends to do something but doesn't?
And maybe I'm embarrassingly out-of-touch, but I always
thought the set of applications where 'awk' is appropriate
and the set of applications so complex that an academic
study of productivity would be pertinent were *disjoint*
sets!
I found Fateman's paper almost as peculiar as Hudak-Jones.
That Lisp doesn't have or need pointers may be a vital difference
and it would be interesting to understand why. I'm sure
automatic garbage-collection is a big part of the answer
(and probably a big part of why Lisp is a more productive
language), but Fateman's emphasis is that Lisp programmers
cannot "incorrectly" increment or deference pointers because
there are no pointers. Is confusion between "(*n)++" and "*n++"
or between "**p" and "*p" really a major source of C's alleged
productivity problem?? If so, perhaps he just needs to hire
better C programmers. Fateman is proud that "NIL" is the
only Boolean false in Lisp. Isn't "0" the only Boolean false
in C? If Fateman posted this kind of nonsense here he'd be
accused of sophomoric trolling.
From Fateman we learn that
(equal foo bar)
is less error-prone than
foo == bar
and that
(+ (* a b) c)
"is arguably clearer" than
a*b + c
Oops, I'm misquoting Fateman. He didn't write
"a*b + c"; he wrote "a*b+c". (Given his straw-man
approach, one is almost surprised he didn't write
"a * b+c" !) In another example, he seems to
think C programmers should know what "b+++c" does,
but don't and that this is an argument against C.
(I'm not too shy to admit *I* wasn't sure what "b+++c"
does. FWIW, gcc behaves as expected when faced with
either "b+ ++c" or "b++ +c" and treats "b+++c" as the
latter. But I can't imagine the "+++" form except in a
trolling question or in an Obfuscation Contest entry.)
(BTW, gcc accepts both "a+ + + +b" and "a+ ++ +b"
without complaint but generates *different* results
for them! Is *this* compliant?)
In other words, many of Fateman's objections would
disappear on a C compiler modified to enforce
complete parenthesization. If Fateman fans want to
argue that this is insignificant trivia, then why did
Fateman ask me to waste so much time reading it?
But let's address Fateman's question. Is
(+ (* a b) c)
actually clearer than the alternative?
a*b + c
Perhaps these examples are too simple to quibble one
way or the other, but all other things being equal,
the version with less ink will be understood more
quickly!
By this measure, Fateman might win the debate with
(dolist (x Foo)
(Guzzle x))
compared with C's slightly less terse
for (x = Foo_head; x; x = x->next)
Guzzle(x);
but a C programmer might #define dolist
if tersity is all that matters.
Frankly, I'd much rather type out the for-loop
than remember what 'dolist' does, especially since
Fateman implies there's a host of such keywords
I'll need to memorize. He seems proud of a
'remove-duplicates' keyword, but *don't* tell him
you could write a remove_duplicates() function if
needed: he stipulates at the top of Page 7 that any C
function will be hard to decode and "possibly erroneous"!
I prefer fewer keywords rather than more.
It may seem that I've singled out the silliest claims
in Fateman's paper. Not really; had that been my goal I
would mention his concern that C comments "can't be nested"
or ridicule his peculiar belief that any claimed virtue
of C need not be refuted if the virtue is dropped in any
language, e.g. Java, that has C-like syntax! (see Pages 7 & 9)
As I implied above, I suspect Common Lisp actually *is*
a more productive language, and furthermore suspect that I,
knowing almost nothing about Lisp, can offer a single
clause more cogent than Fateman's entire paper!:
" ... because it's easier to blithely make copies of
data, leaving them on the floor with the peanut shells,
since Mrs. G.C. stops by to sweep up every afternoon."
I've no idea if the performance cost of the blithely-made
copies is important, but Fateman seems to think so, going
so far as to "counterattack" with a C "inefficiency":
"implementations of C typically waste some number of bits
in each 32-bit pointer for machines that have an actual
address space less than 4 gigabytes"
Wow! Great moments in Computer science. Not!
James Dow Allen