Syntax Matters

Yesterday I wrote about why I wasn’t very interested in Go. Two of my three major complaints were about the syntax of Go, and based on the comments I got here and on Hacker News a lot of people didn’t seem to mind the syntax, or at least didn’t think it was worth talking about. However, the opposite is true, for me the syntax is among the single most important things about a programming language.

I’d estimate that I spend about 60% of my day thinking about and reading code and 40% actually writing code. This means that code needs to be easy to read, that means no stray punctuation or anything else that distracts me from what I want to see in my code: what does it do when I run it. This means any code I’m looking at better be properly indented. It also means that I find braces and semicolons to be noise, stuff that just distracts me from what I’m reading the code to do. Therefore, code ought to use the existing, nonintrusive, structure, instead of obligating me to add more noise.

“Programs must be written for people to read, and only incidentally for machines to execute.” This is a quote from Structure and Interpretation of Computer Programs, by Harold Abelson and Gerald Sussman. It has always struck me as odd that the people who wrote that chose to use Scheme for their text book. In my view Lisp and Scheme are the height of writing for a machine to execute. I think David Heinemeier Hansson got it right when he said, “code should be beautiful”, I spent 5+ hours a day reading it, I damned well better want to look at it.