Recent

Moving to Seattle
Startup Investing for Everyone
There's a Choice
Freeware Game

Language Verbosity

I recently took a look at the upcoming C++0x specification, and I was annoyed that yet more keywords were introduced into the language. C++ is already a very complicated language, and it takes months and years to truly master. I just didn’t think that introducing more keyword would advance the language. In some sense, the size of a language’s vocabulary is a measure of the language’s complexity.

My concern is that as the technology advances, it will become increasingly difficult to be proficient even in one single language. The learning curve just becomes steeper and steeper with time, which is fine if you’re there when they make the curve steeper, but not if you’re at point zero. And I know that specialization happens for all sciences as they advance, but programming isn’t a science and a programming language is a tool, not a science (from the user’s point of view).

Natural languages (such as the one you talk to your mom with, I hope) are not like that, however. Their vocabulary size increases with time, regardless of the language. Unless your language of choice is Newspeak, of course. Another curious fact about human languages is that they allow one to learn the language, using the language. This might not be too clear, so I’ll illustrate:

John Robert Jr IV is 6 years old. His parents speak English (not American, mind you). Little Robert can’t understand everything his intellectual parents say, but, by the time he starts his studies in a snooty British college, he’ll have already mastered the language. How did this happen? Little Robert doesn’t know any other languages but English!

The answer is that one can use English to learn English. This happens because you can understand snippets of code, er, words, and understand the rest from the context and the non-verbal information (intonation, body language, …). In addition, there are always several ways of saying anything, at different levels of complexity. There are synonyms for nearly all words, some down-to- earth, others only for people with a PhD. in Literature. This is how Robbert will slowly learn new words which better articulate what he wants to say.

Sorry, but we really need to get back to programming languages.

Programming languages are like that as well. C++0x may introduce many new constructs, but you don’t really need to use them. When I started programming in C++, I simply changed the file extension to .cpp and continued programming in C. I eventually started using the object-oriented facilities, and after that started learning what the STL really has to offer. So I think there’s room for hope. Having different ways of saying the same thing, some concise, some verbose, is actually a good thing.

This is one of the clashing points of two of my favorite languages - Perl and Python. The Perl philosophy is that there should be many ways to perform the same task. Python believes there should be one (see The Zen of Python). And the thing is that Larry Wall studied linguistics. The language he devised may be a write only language, but the basic idea of having many different ways of expressing yourself doesn’t just give you the opportunity to make yourself clearer, it also makes learning the language easier. You can learn new tricks as you go along, but it doesn’t block you from getting what you want done.

Of course, the above isn’t really true for Perl, unless you can remember what $x is for any x, but the potential is there.