Ruby? Scala? Scheme!

As a programmer you should learn a new programming language once in a while to keep yourself flexible and open to new ideas. After lots of Java coding at work, it was time for me to take a step back and try something new. There were quite a few languages to consider, but after a brief evaluation phase I ended up with Scheme, much to my own surprise.

The Establishment

I've come across a lot of programming languages over the years, not just the well-established ones. Like most people with a computer science background, I can pick up a language quickly - and forget all about it two weeks later. Some languages make a permanent impression, however, and I continue to use them.

Here are the ones that made it; some stayed for their qualities, others because there was simply no way to avoid them:

  • C taught me about pointers, system-level programming and the Unix lifestyle in general. I learned about memory leaks, segfaults, and that you don't have to aim carefully to shoot yourself in the foot.
  • Perl was my introduction to the world of scripting languages. It showed me the power of regular expressions, that beauty is in the eye of the beholder and that a programmer can get used to anything.
  • Python proved to me that a dynamically typed language can be both productive and elegant. It also demonstrated that language evolution is possible without having to start from scratch.
  • Java is the language I used for learning object oriented programming and design. It showed me that a language doesn't have to be exciting as long as its environment is rich and well-designed.
  • From C++ I learned that language design is an art that is better not left to amateurs.

A good language changes the way you think. It helps to get a new perspective and has an impact on how you work with other languages: the ones you know already and those you learn in the future. For example, some object oriented techniques found their way into my C code, and I look for regular expression support and functions as first-level objects in every new language.

The Contenders

I was trying to find an interesting, special language that was different from the ones I already knew. My language of choice had to be somewhat minimal in syntax and concepts, lean, elegant and a pleasure to use. However, it should still be expressive enough to get work done although it didn't have to be immediately useful for my job or open source projects.

Fortunately, there were many contenders:

  • Ruby is certainly interesting: Truly object oriented with functional features, in some aspects even more elegant than Python. I didn't choose Ruby because it's not different enough from Python and Ruby on Rails has lost its appeal recently.
  • Scala has received a lot of hype lately and might in fact be a way to get life back into the Java world. I'll keep an eye on it, but if it does have its breakthrough some day I'll learn it anyway.
  • Groovy seems to be a "me too" language, with features stolen from Java, Python, Ruby, Smalltalk and probably others. I fail to see the things that make it special. Its syntax is certainly not minimal.
  • C#? Well, no .NET-based languages for me. Not for fun anyway.
  • Erlang is famous for its concurrency features, but it feels a bit too much like a niche product, even for me. There aren't many books to choose from, and that was essentially the knock-out criterion.
  • Haskell and languages from the ML family, like OCaml were all tough competitors. At university I had some exposure to Gopher (a Haskell dialect) but wasn't impressed too much.
  • The Lisp family of languages with Common Lisp and Scheme has always been a mystery to me, ever since I tried to learn Emacs Lisp and failed miserably. I simply wasn't ready back then and didn't know lambda calculus.

The Winner

The choice was a difficult one. Most languages I considered had something special about them and I even started to learn a bit of Ruby because its elegance got to me. Then I read about Scala during the Java closures debate and realized that my understanding of functional programming concepts wasn't exactly solid.

Sure, I use a few concepts in other languages like Python (see Functional Programming HOWTO for Python). However, in multi-paradigm languages you tend to fall back to the programming paradigm you're most familiar with, so I wanted a pure functional language to avoid diversions.

I chose Scheme because it's more minimal than Common Lisp and there are great books: The Little Schemer teaches Scheme in a series of questions and answers - a truly unique approach that works surprisingly well. I'm about half through and had a lot of fun so far. And there's The Scheme Programming Language which is available online in full text.

Knowing Scheme itself will probably never be immediately useful. But hey, that's not the point! What I want at the moment is a deeper understanding of functional concepts. I'm sure I can transfer that knowledge to other languages.

social