The Language of The Year for 2008 is Scala

Last week a colleague pointed my at this post by Steve Yegge. It discusses ‘code’s worst enemy’ (size) and asks which new language, by being more expressive, can reduce line count.

Dijkstra said (via Overcoming Bias):

“If we wish to count lines of code, we should not regard them as ‘lines produced’ but as ‘lines spent’: the current conventional wisdom is so foolish as to book that count on the wrong side of the ledger.”

Less expressive languages mean that algorithms need to be duplicated to be applied to different data structures. Yegge doesn’t give any examples, but he’s presumably thinking of things like the paradise benchmark which requires that you can write a function which increases salaries for all employees of a company, without any knowledge of the complicated data structure which represents the company other than the type which represents a Salary.

Steve wants a language which runs on the JVM, which is entirely reasonable. It gives you immediate cross-platform consistency, and the potential to use the thousands of libraries written for Java, if the language has been written to support it.

He rejects JRuby because his colleagues don’t like it and chooses the next generation of Javascript, EcmaScript 4. This has an optional type system which looks as though it is a little less expressive than Java 5’s, and of course has the usual Javascript dynamism.

Many of the comments to Steve’s post suggest Scala, a functional/object oriented language with an advanced type system. I have looked at Scala in the past, but have never been able to ‘get into it’. I think this is because it is too much like Java in syntax, and supports the OO paradigm. In Haskell, by contrast, all you have are functions, algebraic types, and type classes, so you just have to get on with it. Scala left me not knowing where to start.

To remedy that I’ve forked out hard cash for the PDF+printed version of Odersky et. al.’s “Programming in Scala”. I hope that the combination of having spent money, and having a physical book will motivate me to learn the language.

One Comment

  1. Posted January 23, 2008 at 11:53 pm | Permalink

    I’ve been looking at Scala with interest, and while I think it’s a very interesting language that has the potential to give the best of both worlds from static and dynamic languages. But one thing that’s concerned me is that the community around it seems to value terseness above all else, sometimes at the expense of readability. I usually think of terseness as something that can really help readability, but I’ve seen so much example Scala code with single-letter variable names that really interfere with understanding what the functions are supposed to be doing (a habit I’m sure they picked up from the functional language community and mathematicians before them).

    I still think the language could go somewhere if someone uses it to build a framework with immediately obvious value (like Rails was for Ruby). Maybe Lift will be that for Scala, but I wonder if webapp programming is really in Scala’s sweet spot. I guess we’ll see.

Post a Comment

Your email is never shared. Required fields are marked *