Scheme vs. Python

People keep asking me about the choice of programming language in 61A. Here is a rather longer explanation than I could give face to face.

1. The most important thing to understand: The choice of programming language is far from the most important thing in designing a course. The Berkeley party line is that you should be able to learn a programming language (after the first time) over a weekend. If we mean that, then we shouldn’t be arguing about the programming language so much. And we shouldn’t start designing a course by picking a programming language. Honestly, if the new Python-based course turns out to be a better course, I won't mind at all that it’s in Python. It's SICP that I want to preserve, not Scheme.

2. Having said that, something that is important to understand in designing a course is that the best language for a course is not necessarily the best language for writing real-world code. For writing real-world code, what you want is aggressive optimization, and access to libraries for up-to-the-minute solutions to real-world problems. For a course, what you want is a crystal-clear language that highlights the computer science ideas without hiding them in a cloud of syntax or library details.

3. And having said that, I’m not really ready to cede the real world to Python or Java. How many people reading this are 50 years old? Lisp is 50 years old — and for the most part, the lifespan of a programming language is closer to the lifespan of a dog than to that of a person. Only one other language (Fortran) is that old and still in use. Why has Lisp survived? Not because it’s useless. People still use it because you can write working code in Lisp way faster than you can in most so-called “practical” languages.

4. During those entire 50 years, people have been saying “Lisp is impractical”; “Lisp is too slow”; “procedure calling is too expensive”; “only professors care about Lisp.” They’re still saying it. But meanwhile, users — real users — who would never dare give their bosses a program written in Lisp are demanding Lisp’s ideas in the programming languages they do use. Today you take recursion for granted, but it was a radical idea when Lisp introduced it. (Fortran didn't have recursive procedures until fairly late in its history; the early personal computer users made do with BASIC, which, in those early versions, had no procedure calling at all.) Users of strongly typed languages demanded, and got, Lisp's heterogeneous lists. Today, the radical Lisp idea that's invading the mainstream is first class procedures. Guido van Rossum, the inventor of Python, hates Lisp, but he was dragged kicking and screaming by users into providing [a half-assed version of] lambda in Python. Even C++, a notorious can of worms, has added lambda in its most recent version. Lambda in Java is coming in 2013. In another decade they’ll probably discover first class continuations.

5. You can learn to program in any language. But it’s not just an accident that the authors of SICP chose Scheme as their teaching language. The big ideas in the book — the ones that alumni in the real world tell us they’re using in their work — express themselves best in Scheme. Indeed, saying it that way puts the matter backward. Gerry Sussman (with Guy Steele) invented Scheme before he turned (with Hal Abelson) to expressing the ideas behind Scheme in a course. SICP is Scheme, in tutorial form.