Wednesday 26 October 2011

John McCarthy

I wanted to write down a few remembrances of JMC: He was colloquially known at SAIL as just "J M C", not John, not Professor McCarthy. He was at the lab daily and often at night -- his office was in the front of the building. When I first started "flirting" with the AI lab during high school, I was afraid he'd toss me to the curb if he would discover that I was just a high school student. But I believe he just didn't care. In fact, the lab machine would allow you to create an account just by logging in.

When I worked for the computer music project, I saw him often. My most salient memory is when he came into my office (I shared with Bill Gosper and Mike Farmwald) to ask about the radical left poster next to my desk. He wanted to know if I believed whatever was on the poster. I didn't, but I liked the sort of visual style. He said, "OK, I just wanted to know" and walked away. (For those who don't know, JMC took a decidedly right wing turn during the 1970s. Given the background of his parents, that's a remarkable trend).

I can't really separate the contributions of JMC and Les Earnest towards the ultra cool working environment of the AI Lab. To this day, I don't know whether it was the fact that I was fresh out of college or whether it was just a cool place that made the AI lab so special. One must acknowledge that JMC approved of the computer music people coming in over night to use the machine. Without this approval, would computer music have progressed so fast? John Chowning and company depended on this largesse.

McCarthy's contributions to computer science are well known and don't bear repeating. But I'd like to mention two of them in particular: The first is timesharing. As I understand it, the reason the PDP-1 could timeshare was that the drum (not disk, drum) had the ability to read and write simultaneously. So, when the current running user was swapped out, the entire memory was written to the disk while the next user was read in! Second, Markoff's obituary in the Times points out that McCarthy invented Garbage Collection of memory. What a concept!

JMC clearly had a potent vision of that was possible with computers: he sponsored research in AI but also sponsored the system research that would propagate from the lab. So, while we remember McCarthy and Lisp, we should also remember his creation of the Stanford AI Lab and all that came forth from that place.

Saturday 15 October 2011

Dennis and language design

I hadn't intended on writing this entry until Rick Floyd posted about Dennis Ritchie's fine and sparing taste. This brought to mind the influences of language design on C and (by extension) C's influence on further languages.

C's history is well known: it is descended from 'B', which is completely unknown. However, we can look at BCPL. BCPL is a descendant of CPL, which was designed by none other than Christopher Stratchey (talk about an illustrious family, the Stratcheys are amazing). A look at CPL is illuminating: if you know BCPL, then you can see the providence right there. For an example, see his checkers program by Peter Norvig's.

However, CPL was less real than BCPL. BCPL was designed by Martin Richards at Cambridge in 1967. It had a number of interesting features: First, it was designed to be portable over different machine architectures. Second, it's fundamental data type was the machine word. For an assembly language programmer like myself, this was heaven: I could write algorithms and imagine the assembly. Furthermore, the structure construct included both words and bits --- thereby providing an immediate mapping to the machine architecture (device drivers and other machine dependent code). BCPL was the first language for the Alto (which is where I learned it).

So, back to C. What did Dennis to do Ken's version of BCPL? Well, the first thing you have to know about Ken is that he codes fast ... And I think he hates to type. Ever wonder why the Unix kernel has so many short names? Blame Ken. So, then Dennis had to create a spare notation to match. But I think the most noteworthy change was going from words to data types. C goes away from the machine dependent side by incorporating types of Algol 60 lore --- except not making the mistake of calling floats reals. Now, I would be remiss if I didn't mention how C imported bits of the PDP-11 assembler syntax: Ever wonder why autoincrement is ++? Don't. But perhaps the key innovation was the use of the address and de-address operators (& and *). Now you can talk about pointers.

C has undergone many changes since I first learned it at Berkeley reading the Sixth Edition Code. But since I already knew BCPL, it was an easy move. Let me add that I've always loved the for statement in C (even though as a language guy, I know you shouldn't really have more than one way to say something). When you see a for loop used to traverse a list, then you know that's clever.

It's interesting that people mention Java as a descendant of C. If anything, from my perspective, Java is the anti-C. It's way more verbose and eliminates pointers. There are of course many other changes but C is pretty far from Java in my book. And then there's C++, C# and Objective C. They all include the name 'C'...

I wanted to add a personal note about Dennis: He was very private. I certainly knew very little about him during my time in 1127. I do remember when I first got there and a bunch of us were going out to dinner. I stopped by to ask Dennis if he wanted to go. He politely declined. When I reported this to my companions, they said "Sure, Dennis always eats at home with his parents". That's the kind of guy Dennis was. Nice, quiet ... and clever.