Related link: http://www.paulgraham.com/hundred.html
People who read my slides on why Java is actually a pretty good language might have noticed that I pay a lot of attention to Paul Graham. It’s because he has a lot of interesting things to say about programming languages and about programming language design.
His new essay is pretty interesting. There are some interesting insights, and some very questionable assertions.
An example of both is the following quote:
“Semantically, strings are more or less a subset of list in which the elements are characters. So why do you need a separate data type? You don’t, really. Strings only exist for efficiency. But it’s lame to clutter up the semantics of the language with hacks to make programs run faster.”
This is simultaneously an interesting insight, and a very questionable set of assertions. The first sentence raises a red flag for me– the operations I want to do on strings are not the operations I want to do on lists (most of the time), and thinking of strings as lists feels weird because they are so much more complicated. But if you replace “subset” by “subclass” (which is, I think, the intended meaning), it’s not horribly unreasonable. On the other hand, “Strings only exist for efficiency” is flat out wrong. Wrong wrong wrong. The idea of a string class, and of syntactic sugar for the String class, makes a lot of sense even if you remove the efficiency reason entirely, It makes the code more readable than would be the case if you used a general purpose list notation. I still want a string class, and I still want to be able to use “foo” to represent the list foo consisting of three characters because, hey, it’s more readable that way.
On the other hand, “object-oriented programming offers a sustainable way to write spaghetti code” seems bang on the money to me (and it’s about time someone said so out loud).
Anyway. Go read the essay. It’s a fun read.
Seen any recent articles on programming language design that you’d like to pass along?