text
stringlengths
0
412k
the last I heard there were about 20,000.
The Blub ParadoxWhat's so great about Lisp? And if Lisp is so great, why doesn't
everyone use it? These sound like rhetorical questions, but actually
they have straightforward answers. Lisp is so great not because
of some magic quality visible only to devotees, but because it is
simply the most powerful language available. And the reason everyone
doesn't use it is that programming languages are not merely
technologies, but habits of mind as well, and nothing changes
slower. Of course, both these answers need explaining.I'll begin with a shockingly controversial statement: programming
languages vary in power.Few would dispute, at least, that high level languages are more
powerful than machine language. Most programmers today would agree
that you do not, ordinarily, want to program in machine language.
Instead, you should program in a high-level language, and have a
compiler translate it into machine language for you. This idea is
even built into the hardware now: since the 1980s, instruction sets
have been designed for compilers rather than human programmers.Everyone knows it's a mistake to write your whole program by hand
in machine language. What's less often understood is that there
is a more general principle here: that if you have a choice of
several languages, it is, all other things being equal, a mistake
to program in anything but the most powerful one. [3]There are many exceptions to this rule. If you're writing a program
that has to work very closely with a program written in a certain
language, it might be a good idea to write the new program in the
same language. If you're writing a program that only has to do
something very simple, like number crunching or bit manipulation,
you may as well use a less abstract language, especially since it
may be slightly faster. And if you're writing a short, throwaway
program, you may be better off just using whatever language has
the best library functions for the task. But in general, for
application software, you want to be using the most powerful
(reasonably efficient) language you can get, and using anything
else is a mistake, of exactly the same kind, though possibly in a
lesser degree, as programming in machine language.You can see that machine language is very low level. But, at least
as a kind of social convention, high-level languages are often all
treated as equivalent. They're not. Technically the term "high-level
language" doesn't mean anything very definite. There's no dividing
line with machine languages on one side and all the high-level
languages on the other. Languages fall along a continuum [4] of
abstractness, from the most powerful all the way down to machine
languages, which themselves vary in power.Consider Cobol. Cobol is a high-level language, in the sense that
it gets compiled into machine language. Would anyone seriously
argue that Cobol is equivalent in power to, say, Python? It's
probably closer to machine language than Python.Or how about Perl 4? Between Perl 4 and Perl 5, lexical closures
got added to the language. Most Perl hackers would agree that Perl
5 is more powerful than Perl 4. But once you've admitted that,
you've admitted that one high level language can be more powerful
than another. And it follows inexorably that, except in special
cases, you ought to use the most powerful you can get.This idea is rarely followed to its conclusion, though. After a
certain age, programmers rarely switch languages voluntarily.
Whatever language people happen to be used to, they tend to consider
just good enough.Programmers get very attached to their favorite languages, and I
don't want to hurt anyone's feelings, so to explain this point I'm
going to use a hypothetical language called Blub. Blub falls right
in the middle of the abstractness continuum. It is not the most
powerful language, but it is more powerful than Cobol or machine
language.And in fact, our hypothetical Blub programmer wouldn't use either
of them. Of course he wouldn't program in machine language. That's
what compilers are for. And as for Cobol, he doesn't know how
anyone can get anything done with it. It doesn't even have x (Blub
feature of your choice).As long as our hypothetical Blub programmer is looking down the
power continuum, he knows he's looking down. Languages less powerful
than Blub are obviously less powerful, because they're missing some
feature he's used to. But when our hypothetical Blub programmer
looks in the other direction, up the power continuum, he doesn't
realize he's looking up. What he sees are merely weird languages.
He probably considers them about equivalent in power to Blub, but
with all this other hairy stuff thrown in as well. Blub is good
enough for him, because he thinks in Blub.When we switch to the point of view of a programmer using any of
the languages higher up the power continuum, however, we find that
he in turn looks down upon Blub. How can you get anything done in
Blub? It doesn't even have y.By induction, the only programmers in a position to see all the
differences in power between the various languages are those who
understand the most powerful one. (This is probably what Eric
Raymond meant about Lisp making you a better programmer.) You can't
trust the opinions of the others, because of the Blub paradox:
they're satisfied with whatever language they happen to use, because
it dictates the way they think about programs.I know this from my own experience, as a high school kid writing
programs in Basic. That language didn't even support recursion.
It's hard to imagine writing programs without using recursion, but
I didn't miss it at the time. I thought in Basic. And I was a
whiz at it. Master of all I surveyed.The five languages that Eric Raymond recommends to hackers fall at
various points on the power continuum. Where they fall relative
to one another is a sensitive topic. What I will say is that I
think Lisp is at the top. And to support this claim I'll tell you
about one of the things I find missing when I look at the other
four languages. How can you get anything done in them, I think,
without macros? [5]Many languages have something called a macro. But Lisp macros are
unique. And believe it or not, what they do is related to the
parentheses. The designers of Lisp didn't put all those parentheses
in the language just to be different. To the Blub programmer, Lisp
code looks weird. But those parentheses are there for a reason.
They are the outward evidence of a fundamental difference between
Lisp and other languages.Lisp code is made out of Lisp data objects. And not in the trivial
sense that the source files contain characters, and strings are
one of the data types supported by the language. Lisp code, after
it's read by the parser, is made of data structures that you can
traverse.If you understand how compilers work, what's really going on is
not so much that Lisp has a strange syntax as that Lisp has no
syntax. You write programs in the parse trees that get generated
within the compiler when other languages are parsed. But these
parse trees are fully accessible to your programs. You can write