Looking for a new programming language to learn

Posted by – 17/11/2009

I know it has been a long time since my last post. I am sorry about that, but life has it’s complications every now and then (as you know)… Well, on to the article.

Recently I had to reimplement in C a prefork server I wrote in Ruby for an internal project at Propus. Not that the Ruby version wasn’t enough (after all, although being in Ruby, I was using Unix plumbing, much in the fashion Ryan tell us about in the – now famous – I like Unicorn because it’s Unix article)… The problem is that, in one of our clients, the only version available for Ruby was 1.8.1.

Yeah… I know… But we were not allowed to upgrade and, although it didn’t seem at first, the same server presented a nasty memory leak in 1.8.1 that was not present in 1.8.7 and 1.9.1. I still don’t know where the problem is… I suspect some of the C-to-Ruby glues around TCP sockets might be blamed, but after a couple of days trying to figure it out, I decided it was easier just to reimplement it using C.

It actually took less than a day to get the C version going… nothing fancy and, apart from memory footprint, just the same functionality and about the same speed of the Ruby version. But it was enough to remind me I really don’t like all the scaffolding one has to raise in order to make something useful in C. It’s not just a matter of SLOC (of course, C version was more than 3 times longer than Ruby one)… I am talking about all the manual memory management, pointer operations and the disgusting experience of dealing with strings in C. I know some people are addicted to that sort of thing like heroin, but to me it just slows development.

This experience made me think about learning a second compiled programming language. I do some Perl, a lot of Python and (of course) most of my work in Ruby, but those are all interpreted languages. For compiled languages I always resorted to C… So I am officially looking for a language to learn.

So far, the best candidates are OCaml (I got a little excited about JoCaml a few months ago, now I might get serious about it), Haskell, Lisp, Objective-C, Ada, and Vala. Of these, I’ve been reading a lot about OCaml… It seems a fine and expressive language, with decent foundations, object-oriented extension, broad standard library and (with JoCaml) concurrency… Also it might give me the proper excuse to finally wrap my mind around a functional language!

People keep me pointing to Java and Erlang… Well… for using Java I would much prefer using JRuby. Erlang, ITOH, has a weird syntax (at least to me) and it seems much of what makes it great will, eventually, be part of Ruby (or already is using libraries) – either that or I’ll just wait for Reia to be ready. Besides, neither can be compiled to native code (ok, that argument can be stretched both ways, so just ignore it).

So, what do you think? Any advice?

21 Comments on Looking for a new programming language to learn

  1. spectra says:


    All good comments. Thanks for sharing your thoughts. I still haven’t decided, but I think a good advice was given by Anonymous:

    First of all, don’t just learn a language similar to what you already know; bend your mind a little.

    Maybe it’s time to expand my horizons and try a functional language. I was not seriously considering Lisp at first, but I got more found of it. Also, I was not aware that Erlang could be compiled to native code (the compiler is called HiPE by the way), so that piece of information from Paul Bonser puts it back into my considerations.

    So, Go will wait… But I’d like to mention an interesting project I came across in my search for the next language to learn: ooc seems that will become an interesting language.

  2. mirabilos says:

    Dylan, maybe ☺

    mksh, definitively, even if it’s “just” a shell (it’s more)…

  3. Daeng Bo says:

    Vala. Get on the mailing list and follow the tutorials. You might try to start with Genie (Vala’s cousin), which is a compiled language similar to Python.

  4. mike says:

    While erlang does feature a native code compiler, the code still needs the erlang VM to run in, which may be a problem, depending on the reason you need a compiled language for (I assumed the lack of an interpreter/vm as a dependency).

    About the languages, I’m familiar with Python, C, O’Caml and Erlang, and have very limited experience in Haskell. I’ve also studied and read about Lisp, but never actually written anything in it. My first experience with functional programming was with O’Caml, and I’m pretty fond of it. I’m not sure if it’s a good thing that it supports imperative programming (in regard to grasping the essence of functional programming), but I do believe it makes it easier to tackle at first, and it does prove invaluable for certain tasks (plus it contributes to it being blazingly fast on most benchmarks). Not sure about it’s OO extensions though, they don’t seem to be much appreciated in the community.

    Haskell is definitely the one to choose if you want something completely different. Besides purely functional programming, I find laziness much harder to come to terms with, than I originally thought, and it’s type system is more advanced than O’Caml’s. It’s on the top of my list of languages I’d like to be fluent in (Lisp being another one). I also find it’s syntax the next best thing after Python.

    While erlang’s syntax can be appalling at times (especially anything to do with records), it appears to be the language for distributed fault tolerant applications, and one with industry-proven applications to support this.

  5. You might take a look at “Go”, a compiled garbage-collected language that Ken Thompson and Rob Pike et al. did at Google:


  6. TheGZeus says:

    Gambit Scheme, because sqeme needs some help.

  7. I would learn Common Lisp. I’ve found it a breath of fresh air. Don’t worry about the brackets. After a while you almost don’t see them.

    You get a really nice object model in CLOS, you don’t have to worry about types if you don’t want to (though the compiler will often still be able to do type inferencing for you to get more speed) and you’ll get macros. I think macros in CL are one of it’s defining features.

    All of your code is data so it can be manipulated like data and then used as code. Blows your mind a bit.

  8. Paul Bonser says:

    I know you said to ignore it, but Erlang does actually support native code compilation.

    Also, I like to talk about some languages not a lot of people have heard about, so I would suggest you check out Io: http://www.iolanguage.com/

    Or, if you’re looking to expand your mind in a different direction, check out Raven: http://aerosuidae.net/raven.html
    or Factor: http://factorcode.org/

  9. Anonymous says:

    First of all, don’t just learn a language similar to what you already know; bend your mind a little. Thus, I’d suggest learning a functional programming language.

    Personally, I would suggest Haskell.

    As for how to learn it: start a project in it.

  10. Torsten Werner says:

    apt-get install scala

  11. Albert says:

    I love learning new languages. Ruby has been incredibly fun and I feel I’ve learned about programming in general by learning it.

    Lua has been interesting, but I miss a lot of the libraries / bindings I’ve become familiar with in PHP, Perl, and Ruby.

    I’ve heard that learning Lisp can help one learn about programming as well.

    My interest in mathematics has been rekindled, and with it I’m getting exposed to more Haskell than I have in years, which I find interesting.

    Go looks interesting too. From what I’ve read about them, the folks who are the force behind Go will have a lot of value to bring to the table.

    I still need to learn more about C. That article about Unicorn and UNIX looks awesome. Thanks for sharing.

  12. Go (golang.org) or Lua. Some people swear by Haskell. Smalltalk is the most beautiful OO lanuage IMHO, but not everything should be OO. Lisp is a language suited only to very specific problems.

  13. Consider C# or F# – the latter being basically ML running on top of the .NET framework libraries.

  14. Enrico Tassi says:

    Don’t choose the language: first define the problem you want to solve and then choose the language that fits best! According to mi experience, mixing languages may be a good design choice to obtain performances and ease of development.

    I’m a Lua lover, thus I can tell you that Lua is easy, elegant and small. It not compiled but has a fast portable runtime and a good JIT for i386. It is not what you want at if you are looking for a language with thousands of standard libraries (there are many, also in Debian, but less and less standard that what you can find in other languages, even if writing a binding is pretty easy). It is the best choice if you want something embeddable (both in a small device or in a C application) and it is very stable, with good docs and a very nice book (even for non Lua programmers) called Programming in Lua.

    I’m not an OCaml lover, even If I’m pretty fluent with it. I consider it an academic paper driven language, thus expect different areas of the language to interact badly (like functors with objects) and some of them not properly finished (i.e. error messages are pretty unreadable). The effort to provide a decent developing platform inside Debian has been huge, and the result is nice I think, even if the language still lacks a blessed standard library. Writing new bindings is not an option for a beginner. Embedding it in another application is probably even harder.

    I’ve recently used Vala, I liked it, especially the way it is designed, not making the same (IMO) huge mistakes that make C++ hard to integrate with C (even if most people advised it is not). It also has a python like front-end you may be comfortable with. The bad side is that it is still a moving target. They release frequently, usually changing little things in the libraries or in the warning/errors the compiler gives, thus I would not recommend it for a stable product in the short time. Writing bindings for C libraries is simple by design.

    my 2 cents

  15. Zak says:

    From: http://en.wikipedia.org/wiki/Clojure:
    “Clojure is a modern dialect of the Lisp programming language. It is a general-purpose language supporting interactive development that encourages a functional programming style which enables simplified multithreaded programming. Clojure runs on the Java Virtual Machine. Clojure honors the code-as-data philosophy and has a sophisticated Lisp macro system.”

  16. Look at Lisp, Lua or D.

  17. Sake says:

    If you would like to learn a very versatile and cool language, try LISP. You may surely know, that most LISP VMs are quite heavyweight. Especially on virtual servers, this is a big problem. As far as I have been told, OCaml has quite some similarity to LISP, so this is propably a good choice.
    My recommendation for a scenario similar to the one in your blog entry would be D. Compiles to native code, is similary to C++ or more Java if you ask me. And it has a gc.

  18. fotanus says:

    Have you try the google one?
    IMHO C or C++ is the best ones. Vala is also nice.


Leave a Reply

Your email address will not be published. Required fields are marked *